Request获取url信息的各种方法

临时用到需要处理用户的URL,MSDN一下,整理了部分。现和大家Share一下:

测试地址:http://localhost:10710/Engine/Default.aspx?aa=1&bb=c

  • Request.RawUrl---/Engine/Default.aspx?aa=1&bb=c
  • Request.Url.AbsoluteUri---http://localhost:10710/Engine/Default.aspx?aa=1&bb=c
  • Request.FilePath---/Engine/Default.aspx
  • Request.ApplicationPath---/Engine
  • Request.CurrentExecutionFilePath---/Engine/Default.aspx
  • Request.Path---/Engine/Default.aspx
  • Request.PhysicalApplicationPath---C:\Documents and Settings\Administrator\桌面\WorkkFolder\Pages\BlogEngine\Engine\
  • Request.PhysicalPath---C:\Documents and Settings\Administrator\桌面\WorkkFolder\Pages\BlogEngine\Engine\Default.aspx
 

HttpRequest.RawUrl 获取当前请求的原始URL原始 URL 定义为 URL 中域信息之后的部分。在 URL 字符串 http://www.contoso.com/articles/recent.aspx 中,原始 URL /articles/recent.aspx。原始 URL 包括查询字符串(如果存在)。

 

HttpRequest .FilePath: 属性 获取当前请求的虚拟路径。
HttpRequest .ApplicationPath 属性 获取服务器上 ASP.NET 应用程序的虚拟应用程序根路径。
HttpRequest .CurrentExecutionFilePath 属性 获取当前请求的虚拟路径。
HttpRequest .Path 属性 获取当前请求的虚拟路径。
HttpRequest .PhysicalApplicationPath 属性 获取当前正在执行的服务器应用程序的根目录的物理文件系统路径。
HttpRequest .PhysicalPath 属性 获取与请求的 URL 相对应的物理文件系统路径。

 

转载于:https://www.cnblogs.com/netwenchao/archive/2010/02/10/1666981.html

猜你喜欢

转载自blog.csdn.net/weixin_34380781/article/details/93607855