// 当前页面完整URL为:http://www.hicsharp.com/index.aspx?keyword=test&page=1
// 1.获取页面完整的URL,协议名+域名+站点名+文件名+参数
string url = Request.Url.ToString() ;
// 结果:http://www.hicsharp.com/index.aspx?keyword=test&page=1
// 2.获取页面完整的URL,协议名+域名+站点名+文件名+参数
string absoluteUri = Request.Url.AbsoluteUri;
// 结果:http://www.hicsharp.com/index.aspx?keyword=test&page=1
// 3.获取域名或主机,不包含端口
string host = Request.Url.Host;
// 结果:www.hicsharp.com
// 4.获取域名或主机, 包含端口, 如果端口默认是80则不显示
string authority = Request.Url.Authority;
// 结果:www.hicsharp.com:8080
// 5.获取请求页面
string pathAndQuery = Request.Url.PathAndQuery;
// 结果:/index.aspx?keyword=test&page=1
// 6.获取请求页面的真实地址, 如果使用伪静态, 可以获取伪静态指向的页面
// http://www.hicsharp.com/article/123.html
// http://www.hicsharp.com/article/details.aspx?id=123
string rawUrl = Request.RawUrl.ToString();
// 结果:/article/123.html
// 7.获取请求参数
string query = HttpContext.Current.Request.Url.Query;
// 结果:?keyword=test&page=1
其他一些常用参数获取
获取请求页面 Request.RawUrl: --> "/index.aspx" 获取服务器上ASP.NET应用程序的虚拟路径 Request.ApplicationPath: --> "/" 获取当前请求的虚拟路径 Request.CurrentExecutionFilePath: --> "/index.aspx" 获取当前请求的路径 Request.Path: --> "/index.aspx" 获取服务器上的物理文件系统路径 Request.PhysicalPath: --> "d:\wwwroot\demo\index.aspx" 获取请求完整URL Request.Url.AbsoluteUri: --> "http://localhost:8080/index.aspx" 获取请求完整页面 Request.Url.AbsolutePath: --> "/index.aspx"