Is there a way to get the http error code?
I use the following code in my global asax.vb to write entries to the event log and would also like to send the error code(404, 503 etc).
VB Code:
Imports System.Diagnostics Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) Try Dim ErrorDescription As String = Server.GetLastError.ToString 'Creation of event log if it does not exist Dim EventLogName As String = "SibaException" If (Not EventLog.SourceExists(EventLogName)) Then EventLog.CreateEventSource(EventLogName, EventLogName) End If ' Inserting into event log Dim Log As New EventLog() Log.Source = EventLogName Log.WriteEntry(ErrorDescription, EventLogEntryType.Error, [HERE IT WOULD B NICE TO SEND ERROR CODE AS INTEGER]) Catch ex As Exception End Try End Sub


Reply With Quote