Asp.net 全局错误处理
程序员文章站
2024-01-16 23:48:16
protected void Application_Error(object sender, EventArgs e)
...
protected void Application_Error(object sender, EventArgs e)
{
Exception ex = this.Server.GetLastError().GetBaseException();
if (ex is ArgumentErrorException)
{
return;
}
LogHelper.CurrentLogger.Error("出现未预计的异常", ex);
this.Response.Redirect("/Error.aspx");
}