标签:|| server exception action 路径问题 == span eve 静态
global文件中写入 错误日志记录
protected void Application_Error(object sender,EventArgs e) { Exception lastError = Server.GetLastError(); if(lastError!=null) { string strExceptionMessage = string.Empty; //对HTTP 404做额外处理,其他错误全部当成500服务器错误 HttpException httpError = lastError as HttpException; if(httpError!=null) { //获取错误代码 int httpCode = httpError.GetHttpCode(); strExceptionMessage = httpError.Message; if(httpCode==400||httpCode==403||httpCode==404) { Response.StatusCode = httpCode; //跳转到指定的静态404信息页面 Response.WriteFile("~/404.html"); Server.ClearError(); return; } } log.Error(lastError.Message, lastError); Response.WriteFile("~/400.html"); #if DEBUG #else Server.ClearError(); #endif } }
标签:|| server exception action 路径问题 == span eve 静态
原文地址:https://www.cnblogs.com/whl4835349/p/11606931.html