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

 1  //URL: http://localhost:1897/User/Press/UserContent.aspx/9878?id=1#toc
 2             Request.ApplicationPath;    //结果: /
 3             Request.PhysicalPath;     //结果: D:\Projects\Solution\web\User\Press\UserContent.aspx
 4             System.IO.Path.GetDirectoryName(Request.PhysicalPath);     //结果: D:\Projects\Solution\web\User\Press
 5             Request.PhysicalApplicationPath;     //结果: D:\Projects\Solution\web\
 6             System.IO.Path.GetFileName(Request.PhysicalPath);     //结果: UserContent.aspx
 7             Request.CurrentExecutionFilePath;     //结果: /User/Press/UserContent.aspx
 8             Request.FilePath;     //结果: /User/Press/UserContent.aspx
 9             Request.Path;     //结果: /User/Press/UserContent.aspx/9878
10             Request.RawUrl;     //结果:l /User/Press/UserContent.aspx/9878?id=1
11             Request.Url.AbsolutePath;     //结果: /User/Press/UserContent.aspx/9878
12             Request.Url.AbsoluteUri;     //结果: http://localhost:1897/User/Press/UserContent.aspx/9878?id=1
13             Request.Url.Scheme;   //结果: http
14             Request.Url.Host;     //结果: localhost
15             Request.Url.Port;     //结果: 1897
16             Request.Url.Authority;      //结果:localhost:1897
17             Request.Url.LocalPath;     //结果: /User/Press/UserContent.aspx/9878
18             Request.PathInfo;     //结果: /9878
19             Request.Url.PathAndQuery;     //结果: /User/Press/UserContent.aspx/9878?id=1
20             Request.Url.Query; //结果: ?id=1
View Code

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值