'404-File not found' global.asax 파일에서 오류가 발생하여 서버의 텍스트 파일에 오류가 발생하지만 많은 오류가 발생합니다. FormatException Error, Sessionout Error 및 "Yellow Page of"과 같이 나타나지 않았습니다.global.asax에 걸린 모든 오류 C#
여기서 모든 오류를 어떻게 잡을 수 있습니까?
void Application_Error(object sender, EventArgs e)
{
CT.Bussiness.DevCommonFunctions devTools = new CT.Bussiness.DevCommonFunctions();
HttpContext ctx = HttpContext.Current;
//ctx.Response.
// Get page url
if (ctx != null)
{
string pageName = ctx.Request.Url.ToString();
Exception ex = Server.GetLastError().GetBaseException();
HttpException checkException = (HttpException)ex;
if (checkException.GetHttpCode() != 404)
{
string errorDate = DateTime.Now.ToString();
//string pageName =pageName;
string errorMessage = ex.Message;
string errorSource = ex.Source;
//string errorInnerException=ex.InnerException.ToString();
string errorData = ex.Data.ToString();
string errorTarget = ex.TargetSite.ToString();
string errorStack = ex.StackTrace.ToString();
devTools.WriteErrorsIntoErrorLog(errorDate, pageName, errorMessage, errorSource, "InnerException", errorData, errorTarget, errorStack);
//devTools.SendErrorMail("[email protected],[email protected],[email protected],[email protected]", errorDate, pageName, errorMessage, errorSource, "InnerException", errorData, errorTarget, errorStack);
//Response.TrySkipIisCustomErrors = true;
Response.Redirect("~/Error.aspx");
//Response.Redirect("Error.aspx");
}
}
}
내가 아래 KPL Adviced으로이 같이 이어
해결 : ELMAH
- 의 Web.config에 리디렉션 코드를 썼다.
따라서 해결 된!
감사 KPL, 나는 청문회 ELMAH는 오랫동안 여기 I : ELMAH 2. 구현 1. Global.asax에를 제외하고 3. Web.config의에서 리디렉션 코드를 썼다. 따라서 해결! – sajanyamaha