C#/Asp.Net 获取各种Url的方法
2021-05-04 03:29
标签:ons nbsp ati str ext .net web ica port 比如有:http://localhost:60527/WebSite1test/Default2.aspx?QueryString1=1&QueryString2=2 结果: C#/Asp.Net 获取各种Url的方法 标签:ons nbsp ati str ext .net web ica port 原文地址:http://www.cnblogs.com/firstcsharp/p/7727096.htmlResponse.Write("
" + HttpContext.Current.Request.Url.Host);
Response.Write("
" + HttpContext.Current.Request.Url.Authority);
Response.Write("
" + HttpContext.Current.Request.Url.Port);
Response.Write("
" + HttpContext.Current.Request.Url.AbsolutePath);
Response.Write("
" + HttpContext.Current.Request.ApplicationPath);
Response.Write("
" + HttpContext.Current.Request.Url.AbsoluteUri);
Response.Write("
" + HttpContext.Current.Request.Url.PathAndQuery);localhost
localhost:60527
60527
/WebSite1test/Default2.aspx
/WebSite1test
http://localhost:60527/WebSite1test/Default2.aspx?QueryString1=1&QueryString1=2
/WebSite1test/Default2.aspx?QueryString1=1&QueryString2=2