asp.net - 调用 HttpContext.RewritePath() 后如何获取原始 url

标签 asp.net url-rewriting httpmodule

我正在开发一个 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/

相关文章:

java - 与 ASP.NET Http 模块等效的 Java 是什么?

c# - <脚本运行在 ="server"> 与 <% %>

c# - 单击一行时如何从 GridView 重定向

java - 如何让 UrlRewrite 更改我的地址?

apache - .htaccess - 重定向 anchor 链接

正则表达式匹配除特定路径之外的所有 https URL

asp.net - asp.net 3.5 是否支持单个页面上的多个表单?

asp.net - 如何更改回发时的 QueryString?

c# - 如何在 HttpModule 中执行 XSLT 转换?

ASP.NET:将内容注入(inject)所有响应流