ASP.Net Response.Redirect不能在Application_Error中工作?
发布时间:2020-05-24 09:13:08 所属栏目:asp.Net 来源:互联网
导读:我不知道为什么当我将代码部署到IIS7时,Response.Redirect不能正常工作?白/黄错误页面总是显示,而不是我的错误.但是当我的计算机上使用Visual Studio进行调试运行时,它运行正常吗? protected void Application_Error(object sender, EventArgs e) { ILog lo
|
我不知道为什么当我将代码部署到IIS7时,Response.Redirect不能正常工作?白/黄错误页面总是显示,而不是我的错误.但是当我的计算机上使用Visual Studio进行调试运行时,它运行正常吗? protected void Application_Error(object sender,EventArgs e)
{
ILog log = LogManager.GetLogger(typeof(Global).Name);
Exception objErr = Server.GetLastError().GetBaseException();
log.Error(objErr);
string err = "Error Caught in Application_Error eventn" +
"nError Message:" + objErr.Message.ToString() +
"nStack Trace:" + objErr.StackTrace.ToString();
EventLog.WriteEntry("Kiosk",err,EventLogEntryType.Error);
Server.ClearError();
Response.Redirect("~/Error.aspx",false);
}
解决方法我有同样的问题,并解决了:HttpContext.Current.ClearError();
Response.Redirect("~/Error.aspx",false);
return; (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – 如何使用Eval在数据绑定控件中调用扩展方法
- 线程是否在ASP.Net中的请求之间重用?
- ASP.NET表单身份验证 – 在调试时使用测试帐户自动登录?
- asp.net-mvc – ASP.NET MVC领域:它们对大型应用程序很重要
- asp.net – Internet Explorer中的“通过电子邮件发送页面”
- 在asp.net中使用太多会话的缺点
- asp.net-mvc-4 – 如何在mvc4 ActionLink中加密查询字符串I
- asp.net-mvc – 自定义模型绑定,模型状态和数据注释
- asp.net – On-Session-expire-event?
- 何时在ASP.NET管道中初始化会话状态
推荐文章
站长推荐
热点阅读
