【发布时间】:2010-10-19 23:00:18
【问题描述】:
我想获取用户在浏览器中输入的确切网址。当然,我总是可以使用Request.Url.ToString() 之类的东西,但这并不能在以下情况下给我我想要的东西:
http://www.mysite.com/rss
上面的网址Request.Url.ToString()会给我的是:
http://www.mysite.com/rss/Default.aspx
有谁知道如何做到这一点?
我已经试过了:
Request.UrlRequest.RawUrlthis.Request.ServerVariables["CACHE_URL"]this.Request.ServerVariables["HTTP_URL"]((HttpWorkerRequest)((IServiceProvider)HttpContext.Current).GetService(typeof(HttpWorkerRequest))).GetServerVariable( "CACHE_URL")((HttpWorkerRequest)((IServiceProvider)HttpContext.Current).GetService(typeof(HttpWorkerRequest))).GetServerVariable( "HTTP_URL")
【问题讨论】:
-
如果您查看 Cassini 源代码,您会看到用户请求的 URL 在调用 HttpRuntime.ProcessRequest 之前被覆盖(在某些情况下)。这几乎排除了任何与 HttpWorkerRequest 无关的方式。