现在的位置: 首页 > 综合 > 正文

Request获取url信息的各种方法

2013年05月26日 ⁄ 综合 ⁄ 共 1051字 ⁄ 字号 评论关闭

临时用到需要处理用户的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 相对应的物理文件系统路径。

 

抱歉!评论已关闭.