您的位置:首页 > 编程语言 > ASP

URL 的各个部分和通过ASP.NET获取URL地址的方法

2010-05-20 18:11 746 查看
網址:http://localhost:1897/News/Press/Content.aspx/123?id=1#toc
Request.ApplicationPath/
Request.PhysicalPathD:/Projects/Solution/web/News/Press/Content.aspx
System.IO.Path.GetDirectoryName(Request.PhysicalPath)D:/Projects/Solution/web/News/Press
Request.PhysicalApplicationPathD:/Projects/Solution/web/
System.IO.Path.GetFileName(Request.PhysicalPath)Content.aspx
Request.CurrentExecutionFilePath/News/Press/Content.aspx
Request.FilePath/News/Press/Content.aspx
Request.Path/News/Press/Content.aspx/123
Request.RawUrl/News/Press/Content.aspx/123?id=1
Request.Url.AbsolutePath/News/Press/Content.aspx/123
Request.Url.AbsoluteUrihttp://localhost:1897/News/Press/Content.aspx/123?id=1
Request.Url.Schemehttp
Request.Url.Hostlocalhost
Request.Url.Port1897
Request.Url.Authoritylocalhost:1897
Request.Url.LocalPath/News/Press/Content.aspx/123
Request.PathInfo/123
Request.Url.PathAndQuery/News/Press/Content.aspx/123?id=1
Request.Url.Query?id=1
Request.Url.Fragment
Request.Url.Segments/
News/
Press/
Content.aspx/
123
如果测试的url地址是http : //www.test.com/testweb/default.aspx, 结果如下:
Request.ApplicationPath: /testweb
Request.CurrentExecutionFilePath: /testweb/default.aspx
Request.FilePath: /testweb/default.aspx
Request.Path: /testweb/default.aspx
Request.PhysicalApplicationPath: E:/WWW/testwebRequest.PhysicalPath:
Request.PhysicalPath: E:/WWW/testweb/default.aspx
Request.RawUrl: /testweb/default.aspx
Request.Url.AbsolutePath: /testweb/default.aspx
Request.Url.AbsoluteUrl: http://www.test.com/testweb/default.aspx
Request.Url.Host: www.test.com
Request.Url.LocalPath: /testweb/default.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: