我正在开发一个 Web 应用程序,该应用程序使用执行 url 重写的 3rd 方 HttpModule。
我想知道是否有任何方法可以稍后在 Application_BeginRequest
中确定原始 url事件。例如...
原网址:http://domain.com/products/cool-hat.aspx
重写的 url(来自 3rd 方 httpmodule):http://domain.com/products.aspx?productId=123
过去,我编写了 HttpModules 将原始 url 存储在 HttpContext.Items 中,但是,这是一个 3rd 方应用程序,我无法做到这一点。
任何想法,将不胜感激。
最佳答案
尝试这个:
string originalUrl = HttpContext.Current.Request.RawUrl;
原始 URL 位于此属性内。
关于asp.net - 调用 HttpContext.RewritePath() 后如何获取原始 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2427561/