eramgarden
Contributor
- Joined
- Mar 8, 2004
- Messages
- 579
I added 2 kinds of error handling to my code:
In web.config , i have this
In Global.asax , I have this to log to even viewer:
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??
In web.config , i have this
Code:
<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:
Code:
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??