Global.asax中的Application_Error不集成模式下工作 [英] Global.asax Application_Error doesn't work with Integrated Mode
本文介绍了Global.asax中的Application_Error不集成模式下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
的Application_Error不集成模式下工作,但确实与类模式下工作。
我会转移请求错误使用这两种集成模式和类模式页。可以这样做,或我必须使用HTTP模块,以支持这两种模式?
保护无效的Application_Error(对象发件人,EventArgs的发送)
{
如果(上下文= NULL&放大器;!&安培; Context.IsCustomErrorEnabled)
{
Server.Transfer的(〜/ Error.aspx,FALSE);
}
}
解决方案
您可以尝试从 Server.Transfer的
更改code到 Server.TransferRequest
。
看到另一个问题<一个我的答案href=\"http://stackoverflow.com/questions/5774502/server-transfer-with-app-pool-set-to-integrated/7472887#7472887\">here.
Application_Error doesn't work with Integrated Mode but does work with Class Mode. I would to transfer request to error page using both Integrated Mode and Class Mode. Can this be done or I have to use HTTP module in order to support both modes?
protected void Application_Error(object sender, EventArgs e)
{
if (Context != null && Context.IsCustomErrorEnabled)
{
Server.Transfer("~/Error.aspx", false);
}
}
解决方案
You could try changing your code from Server.Transfer
to Server.TransferRequest
.
See my answer on another question here.
这篇关于Global.asax中的Application_Error不集成模式下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文