Request获取url信息的各种方法

妖精的绣舞 提交于 2020-02-20 16:49:39

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

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!