假设我们的网址为http://localhost:1897/ News/Press/Content.aspx?id=1019
跟 Browser Request 的网址相关的属性与方法 | 输出(output)实例 | 备 注 |
Request.ApplicationPath | / | 指的是当前的application(应用程序)的目录 |
Request.PhysicalPath | D:/Projects/Solution/web/News/Press/Content.aspx | 磁盘驱动器代号:/父目录/子目录/Content.aspx |
Request.PhysicalApplicationPath | D:/Projects/Solution/web/ | 磁盘驱动器代号:/父目录/子目录/ |
Request.CurrentExecutionFilePath | /News/Press/Content.aspx |
|
Request.FilePath | /News/Press/Content.aspx | 对应于iis的虚拟目录。 |
Request.Path | /News/Press/Content.aspx | 当前请求的虚拟路径。Path 是 FilePath 和 PathInfo 尾部的串联。*(见下面详细讲解) |
Server.MapPath(string url) | 例http://www.example.com/1/index.html, 假设你的应用程序在c:/iis/MySite中,那么就是c:/iis/MySite/1/index.html | 将url映射为服务器上的物理路径 |
Request.RawUrl | /News/Press/Content.aspx?id=1019 |
|
Request.Url.AbsolutePath | /News/Press /Content.aspx |
|
Request.Url.AbsoluteUri | http://localhost:1897/Content.aspx?id=1019 |
|
Request.Url.LocalPath | /News/Press//Content.aspx |
|
Request.Url.PathAndQuery | /News/Press//Content.aspx?id=1019&uu=77 |
|
Request.Url.Scheme | http |
|
Request.Url.Host | localhost |
|
Request.Url.Port | 1987 |
|
Request.Url.Authority | localhost:1897 |
|
Request.Url.Query | ?id=1019 |
|
Request.Url.Query[id] | 1019 |
|
Request.Url.Fragments | / |
|
Request.Url.Segments[0] | / |
|
System.IO.Path.GetDirectoryName(Request.PhysicalPath) | D:/Projects/Solution/web/News/Press | 磁盘驱动器代号:/父目录/子目录/
|
System.IO.Path.GetFileName(Request.PhysicalPath) | Content.aspx |
|