当Redirect
或Response.Write
事件发生时,我无法在我的应用程序中使用Application_End
或Application_Error
。
protected void Application_Error(object sender, EventArgs e)
{
string strError;
strError = Server.GetLastError().ToString();
this.Context.ClearError();
Response.Write("Application_Error" + "<br/>");
Response.Write("Error Msg: " + strError + "<br/>");
}
任何帮助将不胜感激,谢谢
编辑:我正在尝试检测应用程序池回收并重定向到错误页面。
你应该能够做Server.Transfer
几乎相当于Response.Redirect
。可以理解的是,由于您不再在Page的上下文中执行,因此无法执行Response.Write
。