2011-02-12 74 views
0

我在Global.asax中使用HttpContext.RewritePath來進行一些URL重寫,並且它在我的開發環境中在Cassini服務器上工作得非常好。但是,當我將它複製到運行IIS 7的生產服務器時,它不起作用。我也嘗試使用Context.Server.TransferRequest,但後來我得到錯誤:「此操作需要IIS集成管道模式。」在卡西尼 IIS 7上(在IIS 7上,網站在AppPool中以「集成」模式運行)。IIS 7上的httpContext.RewritePath問題

我重寫了網站上的所有網址,例如/[The main menuname]/[pagename].aspx/web/thesite.aspx?mainmenu=manager/manager/thesite.aspx OR /web/theOtherSite.aspx?mainmenu=about/about/theOtherSite.aspx,等等...

+0

如果您對爲什麼不使用IIS發展Vista或Window 7.或者,您可以使用IIS 7 express http://weblogs.asp.net/scottgu/archive/2010/06/28/introducing-iis-express.aspx,希望您能夠進行調試你的問題。另外,您是否可以更好地重新格式化網址,以便我們瞭解「之前」和「之後」網址? – 2011-02-12 07:31:06

回答

1

我發現我需要添加以下到Web.config中

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