Dear All
I have created a Class which I use for recording errors/exceptions to an SQL database via the health monitoring events called ErrorHandling.vb:
Imports Microsoft.VisualBasic
Imports System.Web.Management
Public Class ErrorHandling
Inherits WebRequestErrorEvent
Public Sub New(ByVal message As String, ByVal eventSource As Object, ByVal exception As Exception)
MyBase.New(message, eventSource, CInt(MyEventCodes.RecoveredException), exception)
End Sub
Public Enum MyEventCodes As Integer
Foo = WebEventCodes.WebExtendedBase + 1
Bar
RecoveredException
End Enum
End Class
I normally use this Class from any of my web forms in the following way which works fine:
Try
..some code...
Catch ex As Exception
ErrorHandling.Raise(New ErrorHandling("My error message details go here).", Me, ex))
...
Go to the complete details ...