eramgarden Posted April 22, 2004 Posted April 22, 2004 I added 2 kinds of error handling to my code: In web.config , i have this <customErrors defaultRedirect="ApplicationError.htm" mode="RemoteOnly" > <error statusCode="403" redirect="pages\Forbidden.htm"/> <error statusCode="404" redirect="NotFound.htm"/> </customErrors> In Global.asax , I have this to log to even viewer: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Fires when an error occurs Dim unhandledException As Exception = Server.GetLastError().InnerException If Not EventLog.SourceExists("ESPWebClient") Then EventLog.CreateEventSource("ESPWebClient", "ESPWebClient Log") End If Dim el As EventLog = New EventLog() el.Source = "ESPWebClient" el.WriteEntry("An exception occured: Created an entry in the event log") 'Server.ClearError() End Sub I got an unhandeled error, But instead of loging to event viewer, the Custom Error in WebConfig popped up Why didnt the application error in Global.asax fire?? Quote
fadi Posted April 23, 2004 Posted April 23, 2004 use either one of the ways, either remove the custom errors and place the redirections in global.asax or remove the application_error event they both do the same job Quote
eramgarden Posted April 23, 2004 Author Posted April 23, 2004 they both do the same job ... No, i think they're different... The Application_Error takes care of overall Application unhandled errors... So i think in this case, i think application_error should've fired.. I'm still not sure why, how the custom error fired ?? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.