.NET获取URL路径几个方法

来源:互联网 发布:实施工程师sql笔试题 编辑:程序博客网 时间:2024/06/07 10:56
测试的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/testweb/ 
Request.PhysicalPath:  
  结果:E:/WWW/testweb/default.aspx 
Request.RawUrl:  
  结果:/testweb/default.aspx 
Request.Url.AbsolutePath:  
  结果:/testweb/default.aspx 
Request.Url.AbsoluteUri:  
  结果:http://www.test.com/testweb/default.aspx 
Request.Url.Host:  
  结果:www.test.com 
Request.Url.LocalPath:  
  结果:/testweb/default.aspx
0 0
原创粉丝点击