.net 获取url的方法

测试的url地址是http://www.gkxsn.com/testweb/default.aspx?id=1, 结果如下:
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?id=1
Request.Url.AbsolutePath: /testweb/default.aspx
Request.Url.AbsoluteUri: http://www.gkxsn.com/testweb/default.aspx?id=1
Request.Url.Host: www.gkxsn.com
Request.Url.LocalPath: /testweb/default.aspx
Response.Write("<b>Request.ApplicationPath:</b> " + Request.ApplicationPath + "<br>");
Response.Write("<b>Request.CurrentExecutionFilePath:</b> " + Request.CurrentExecutionFilePath + "<br>");
Response.Write("<b>Request.FilePath:</b> " + Request.FilePath + "<br>");
Response.Write("<b>Request.Path:</b> " + Request.Path + "<br>");
Response.Write("<b>Request.PathInfo:</b> " + Request.PathInfo + "<br>");
Response.Write("<b>Request.PhysicalApplicationPath:</b> " + Request.PhysicalApplicationPath + "<br>");
Response.Write("<b>Request.PhysicalPath:</b> " + Request.PhysicalPath + "<br>");
Response.Write("<b>Request.RawUrl:</b> " + Request.RawUrl + "<br>");
Response.Write("<b>Request.Url.AbsolutePath:</b> " + Request.Url.AbsolutePath + "<br>");
Response.Write("<b>Request.Url.AbsoluteUri:</b> " + Request.Url.AbsoluteUri + "<br>");
Response.Write("<b>Request.Url.Host:</b> " + Request.Url.Host + "<br>");
Response.Write("<b>Request.Url.LocalPath:</b> " + Request.Url.LocalPath + "<br>");

作者:罗敏贵
邮箱:minguiluo@163.com
QQ群:34178394 建群 主要是寻找志同道合的人士一起学习和讨论自己的所学所思
出处:http://luomingui.cnblogs.com/
说明:专注于微软平台项目架构、熟悉设计模式、架构设计、敏捷个人和项目管理。现主要从事WinForm、ASP.NET、等方面的项目开发、架构、管理工作。文章为作者平时里的思考和练习,可能有不当之处,请博客园的园友们多提宝贵意见。
知识共享许可协议本作品采用知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议进行许可。

原文地址:https://www.cnblogs.com/luomingui/p/2082531.html