.net 获取当前网页的的url

正确的方法是:HttpContext.Current.Request.Url.PathAndQuery1、通过ASP.NET获取
如果测试的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	estwebRequest.PhysicalPath:                   E:WWW	estwebdefault.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
编程不是为了生存,更多的是乐趣和成就感~
原文地址:https://www.cnblogs.com/dckhello/p/5535934.html