获取当前请求的URL的地址、参数、参数值、各种属性

  //URL: http://localhost:1897/User/Press/UserContent.aspx/9878?id=1#toc
Request.ApplicationPath; //结果: /
Request.PhysicalPath; //结果: D:\Projects\Solution\web\User\Press\UserContent.aspx
System.IO.Path.GetDirectoryName(Request.PhysicalPath); //结果: D:\Projects\Solution\web\User\Press
Request.PhysicalApplicationPath; //结果: D:\Projects\Solution\web\
System.IO.Path.GetFileName(Request.PhysicalPath); //结果: UserContent.aspx
Request.CurrentExecutionFilePath; //结果: /User/Press/UserContent.aspx
Request.FilePath; //结果: /User/Press/UserContent.aspx
Request.Path; //结果: /User/Press/UserContent.aspx/9878
Request.RawUrl; //结果:l /User/Press/UserContent.aspx/9878?id=1
Request.Url.AbsolutePath; //结果: /User/Press/UserContent.aspx/9878
Request.Url.AbsoluteUri; //结果: http://localhost:1897/User/Press/UserContent.aspx/9878?id=1
Request.Url.Scheme; //结果: http
Request.Url.Host; //结果: localhost
Request.Url.Port; //结果: 1897
Request.Url.Authority; //结果:localhost:1897
Request.Url.LocalPath; //结果: /User/Press/UserContent.aspx/9878
Request.PathInfo; //结果: /9878
Request.Url.PathAndQuery; //结果: /User/Press/UserContent.aspx/9878?id=1
Request.Url.Query; //结果: ?id=1
上一篇:本周ASP.NET英文技术文章推荐[02/03 - 02/16]:MVC、Visual Studio 2008、安全性、性能、LINQ to JavaScript、jQuery...


下一篇:把握曝光三要素(上):快门、光圈、ISO