Windows 2008框上的global.asax重定向失败 [英] global.asax redirect failing on windows 2008 box
问题描述
我将站点放在2003服务器上之后,将站点移到了2008上,并进行了一些测试,结果发现对错误的重定向无法转到我拥有的error.aspx页面.我已经搜索了很长时间,没有解决任何办法.
我寻找了一个IIS论坛,但找不到一个.我认为解决方案是在IIS中,但我不确定.
任何帮助将不胜感激.
I moved a site onto a 2008 box after having it on a 2003 server box and did some testing only to find that the redirection on an error failed to go to the error.aspx page I had. I''ve been googling this for quite some time to no solution.
I looked for an IIS forum, but couldn''t find one. I think the solution is in IIS, but I''m not sure.
Any help would be much appreciated.
推荐答案
对错误的重定向无法转到error.aspx页
redirection on an error failed to go to the error.aspx page
因此,您是要从global.asax
在错误页上进行重定向吗?您可以向我们展示Application_Error的代码吗?
我想您正在使用Response.Redirect From Application_Error
.
这是与IIS 7及其集成模式有关的问题.您正在使用哪种模式? Integrated or Classic
?
如果它的集成模式并更改为经典模式可能有效.
^ ]我找到了一个很好的解决方案[总结如下]
分析:
该问题是由于在Application_Error中调用Response.Redirect()时,IIS7新的集成管道模式的行为发生了更改.默认的.net错误页面将在由于检测到错误而导致实际重定向发生之前呈现.
解决方案
1.在web.config中的system.webServer/modules下删除ScriptModule的模块定义.例如:
So, you are redirecting on Error Page from global.asax
? Can you show us the code for Application_Error Secction ?
I guess you are using Response.Redirect From Application_Error
.
This is the Problem related with IIS 7 and Its integration mode. Which mode you are using ? Integrated or Classic
?
if Its Integrated mode and change to classic it may work.
Here[^] I found a good solution [ The summary as below ]
Analysis :
The problem is caused by changed behavior of IIS7 new integrated pipeline mode when calling Response.Redirect() in Application_Error. The default .net error page will be rendered before the actual redirection occurs due to error is detected.
Solution
1. Remove the module definition of ScriptModule under system.webServer/modules in web.config. e.g:
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
如果不使用Application_PreSendRequestHeader
和Application_PreSendRequestContent
事件处理程序,请从global.asax
中删除它们.
2.调用Context.ClearError
或Server.ClearError
在Application_Error
中使用Response.Redirect()
之前清除错误.
希望这对您有帮助:-D
Remove Application_PreSendRequestHeader
and Application_PreSendRequestContent
event handlers from global.asax
if they are not used.
2.Call Context.ClearError
or Server.ClearError
to clear the error before using Response.Redirect()
in Application_Error
.
Hope this will help you :-D
这篇关于Windows 2008框上的global.asax重定向失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!