服務(wù)熱線
153 8323 9821
設(shè)當前頁完整地址是:http://www.idc311.com/aaa/bbb.aspx?id=5&name=kelli
"http://"是協(xié)議名
"www.idc311.com"是域名
"aaa"是站點名
"bbb.aspx"是頁面名(文件名)
"id=5&name=kelli"是參數(shù)
【1】獲取 完整url (協(xié)議名+域名+站點名+文件名+參數(shù))
string url=Request.Url.ToString();
url= http://www.idc311.com/aaa/bbb.aspx?id=5&name=kelli
【2】獲取 站點名+頁面名+參數(shù):
string url=Request.RawUrl;
(或 string url=Request.Url.PathAndQuery;)
url= /aaa/bbb.aspx?id=5&name=kelli
【3】獲取 站點名+頁面名:
string url=HttpContext.Current.Request.Url.AbsolutePath;
(或 string url= HttpContext.Current.Request.Path;)
url= aaa/bbb.aspx
【4】獲取 域名:
string url=HttpContext.Current.Request.Url.Host;
url= www.idc311.com
【5】獲取 參數(shù):
string url= HttpContext.Current.Request.Url.Query;
url= ?id=5&name=kelli
Request.RawUrl:獲取客戶端請求的URL信息(不包括主機和端口)------>/Default2.aspx
Request.ApplicationPath:獲取服務(wù)器上ASP.NET應(yīng)用程序的虛擬路徑。------>/
Request.CurrentExecutionFilePath
Request.Path:獲取當前請求的虛擬路徑。------>/Default2.aspx
Request.PathInfo:取具有URL擴展名的資源的附加路徑信息------>
Request.PhysicalPath:獲取與請求的URL相對應(yīng)的物理文件系統(tǒng)路徑。------>E:\temp\Default2.aspx
Request.Url.LocalPath:------>/Default2.aspx
Request.Url.AbsoluteUri:------>http://localhost:8080/Default2.aspx
Request.Url.AbsolutePath:---------------------------->/Default2.aspx