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