IIS 7上的httpContext.RewritePath问题

时间:2011-02-12 07:20:47

标签: asp.net iis-7 url-rewriting global-asax

我在Global.asax中使用HttpContext.RewritePath进行一些URL重写,它在我的Cassini服务器上的开发环境中运行良好。但是当我将它复制到运行IIS 7的生产服务器时,它无法正常工作。我也尝试使用Context.Server.TransferRequest,但后来我收到错误:“此操作需要IIS集成管道模式。”在Cassini IIS 7上(在IIS 7上,网站在AppPool中以“集成”模式运行)。

我重写网站上的所有网址,例如/[The main menuname]/[pagename].aspx,例如从/web/thesite.aspx?mainmenu=manager/manager/thesite.aspx/web/theOtherSite.aspx?mainmenu=about/about/theOtherSite.aspx,依此类推......

1 个答案:

答案 0 :(得分:1)

我发现我需要将以下内容添加到web.config

 <configuration>
<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
</system.webServer></configuration>