星空网 > 软件开发 > ASP.net

ASP.NET获取URL

//获取完整url (协议名+域名+站点名+文件名+参数)
string fullUrl = Request.Url.ToString();

//获取客户端请求的URL信息(不包括主机和端口)
string rawUrl = Request.RawUrl;


//获取站点名+页面名
string absolutePath = Request.Url.AbsolutePath;


//获取主机部分
string urlHost = Request.Url.Host;


//获取参数部分
string urlQuery = Request.Url.Query;


//获取服务器上ASP.NET应用程序的虚拟路径
string ApplicationPath = Request.ApplicationPath;


//获取当前请求的虚拟路径
string CurrentExecutionFilePath = Request.CurrentExecutionFilePath;


//获取当前请求的虚拟路径
string Path = Request.Path;


//获取具有URL扩展名的资源的附加路径信息
string PathInfo = Request.PathInfo;


//获取与请求的URL相对应的物理文件系统路径
string PhysicalPath = Request.PhysicalPath;


//获取文件名的本地操作系统表示形式
string LocalPath = Request.Url.LocalPath;


//获取绝对URL
string AbsoluteUri = Request.Url.AbsoluteUri;


StringBuilder sb = new StringBuilder();

sb.Append("获取完整url(协议名+域名+站点名+文件名+参数):" + fullUrl + "<br />");
sb.Append("获取客户端请求的URL信息(不包括主机和端口):" + rawUrl + "<br />");
sb.Append("获取站点名+页面名:" + absolutePath + "<br />");
sb.Append("获取主机部分:" + urlHost + "<br />");
sb.Append("获取参数部分:" + urlQuery + "<br />");
sb.Append("获取应用程序的虚拟应用程序根路径:" + ApplicationPath + "<br />");
sb.Append("获取当前请求的虚拟路径:" + Path + "<br />");
sb.Append("获取具有URL扩展名的资源的附加路径信息:" + PathInfo + "<br />");
sb.Append("获取与请求的URL相对应的物理文件系统路径:" + PhysicalPath + "<br />");
sb.Append("获取文件名的本地操作系统表示形式:" + LocalPath + "<br />");
sb.Append("获取绝对URL:" + AbsoluteUri + "<br />");
Response.Write(sb.ToString());




原标题:ASP.NET获取URL

关键词:ASP.NET

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

狗狗磨牙棒:https://www.goluckyvip.com/tag/6552.html
印度孟买海关:https://www.goluckyvip.com/tag/6553.html
虚报货品:https://www.goluckyvip.com/tag/6554.html
美国邮政快递:https://www.goluckyvip.com/tag/6555.html
listing上架:https://www.goluckyvip.com/tag/6556.html
旺季备忘录:https://www.goluckyvip.com/tag/6557.html
昆明旅游索道公司 昆明旅游索道公司有哪些:https://www.vstour.cn/a/406243.html
太仓美食网(探寻太仓最美味的美食):https://www.vstour.cn/a/406244.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流