国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

asp.net Request獲取url信息的各種方法比較

2024-07-10 12:42:33
字體:
來源:轉載
供稿:網友
本頁地址: Request.URL;
上頁地址:
代碼如下:
Request.UrlReferrer
Request.ServerViables["http_referer"]
Request.RawUrl
Request.RawUrl.QueryAndPath
System.IO.Path.GetFileName(Request.FilePath.ToString())

在ASP.NET編程中經常需要用Request獲取url的有關信息,Request中有多種方法獲取 url信息,但我經常忘了各種方法的具體作用,今天我就寫了個測試程序,將各種方法得到的結果列出來,以后用時直接參考一下就行了。
測試的url 地址是http://www.test.com/testweb/default.aspx, 結果如下:
代碼如下:
Request.ApplicationPath: /testweb
Request.CurrentExecutionFilePath: /testweb/default.aspx
Request.FilePath: /testweb/default.aspx
Request.Path: /testweb/default.aspx
Request.PathInfo:
Request.PhysicalApplicationPath: E:/WWW/testweb/
Request.PhysicalPath: E:/WWW/testweb/default.aspx
Request.RawUrl: /testweb/default.aspx
Request.Url.AbsolutePath: /testweb/default.aspx
Request.Url.AbsoluteUri: http://www.test.com/testweb/default.aspx
Request.Url.Host: www.test.com
Request.Url.LocalPath: /testweb/default.aspx

當url中帶參數時可以使用:
HttpContext.Current.Request.Url.PathAndQuery.ToString()
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 九江市| 卓资县| 平山县| 巴南区| 夏河县| 静安区| 丰县| 双城市| 资中县| 汕尾市| 井研县| 柳林县| 双桥区| 龙江县| 桓仁| 沐川县| 永寿县| 开封市| 喀喇沁旗| 韶山市| 涿鹿县| 桑植县| 北海市| 大厂| 维西| 沧州市| 临泽县| 综艺| 香港 | 肇源县| 白玉县| 牟定县| 调兵山市| 扬州市| 盱眙县| 陇西县| 正安县| 武穴市| 紫金县| 琼海市| 封开县|