欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時(shí)間:2010年03月04日 19:42:21   作者:  
Request 獲取url信息的各種方法比較
本頁地址: Request.URL;
上頁地址:
復(fù)制代碼 代碼如下:

Request.UrlReferrer
Request.ServerViables["http_referer"]
Request.RawUrl
Request.RawUrl.QueryAndPath
System.IO.Path.GetFileName(Request.FilePath.ToString())

在ASP.NET編程中經(jīng)常需要用Request獲取url的有關(guān)信息,Request中有多種方法獲取 url信息,但我經(jīng)常忘了各種方法的具體作用,今天我就寫了個(gè)測試程序,將各種方法得到的結(jié)果列出來,以后用時(shí)直接參考一下就行了。
測試的url 地址是http://www.test.com/testweb/default.aspx, 結(jié)果如下:
復(fù)制代碼 代碼如下:

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

當(dāng)url中帶參數(shù)時(shí)可以使用:
HttpContext.Current.Request.Url.PathAndQuery.ToString()

相關(guān)文章

最新評(píng)論