Health Monitoring in ASP.NET 2

WebEvents Class

Imports DeveloperMeeting
Imports DeveloperMeeting.DataProvider

Namespace EventLog
    Public NotInheritable Class WebEvents #Region " Constructor "
        Public Sub New(ByVal ConnectionString As String)             _ConnectionString = ConnectionString             DSEventLog = SqlDataProvider.FillDataSet(ConnectionString, _             "DM_WebEvent_GetLogEvent", _ CommandType.StoredProcedure, Nothing)         End Sub #End Region

#Region " Declarations "
        Dim DSEventLog As New DataSet
        Dim _ConnectionString As String
#End Region
#Region " Propreties "
        Public ReadOnly Property Count() As Integer
                Return DSEventLog.Tables(0).Rows.Count
            End Get
        End Property
#End Region #Region " GetEventLog Method "
        Public Function GetEventLog(ByVal Index As Integer) As [Event]
            Dim Return_Value As New [Event]
            With Return_Value
                .EventID = DSEventLog.Tables(0).Rows(Index)("EventId")
                .EventTimeUtc = DSEventLog.Tables(0).Rows(Index)("EventTimeUtc")
                .EventTime = DSEventLog.Tables(0).Rows(Index)("EventTime")
                .EventType = DSEventLog.Tables(0).Rows(Index)("EventType")
                .EventSequence = DSEventLog.Tables(0).Rows(Index)("EventSequence")
                .EventOccurrence = DSEventLog.Tables(0).Rows(Index)("EventOccurrence")
                .EventCode = DSEventLog.Tables(0).Rows(Index)("EventCode")
                .EventDetailCode = DSEventLog.Tables(0).Rows(Index)("EventDetailCode")
                .Message = IIf(DSEventLog.Tables(0).Rows(Index)("Message") Is DBNull.Value, _
vbNullString, DSEventLog.Tables(0).Rows(Index)("Message"))
                .ApplicationPath = IIf(DSEventLog.Tables(0).Rows(Index)("ApplicationPath") _
Is DBNull.Value, vbNullString, DSEventLog.Tables(0).Rows(Index)
                .ApplicationVirtualPath = IIf(DSEventLog.Tables(0).Rows(Index) _
("ApplicationVirtualPath") Is DBNull.Value, vbNullString, _
                .MachineName = DSEventLog.Tables(0).Rows(Index)("MachineName")
                .RequestUrl = IIf(DSEventLog.Tables(0).Rows(Index)("RequestUrl") _
Is DBNull.Value, vbNullString, DSEventLog.Tables(0).Rows(Index)("RequestUrl"))
                .ExceptionType = IIf(DSEventLog.Tables(0).Rows(Index)("ExceptionType") _
Is DBNull.Value, vbNullString, DSEventLog.Tables(0).Rows(Index) _
                .Details = IIf(DSEventLog.Tables(0).Rows(Index)("Details") Is DBNull.Value, _
vbNullString, DSEventLog.Tables(0).Rows(Index)("Details"))
            End With
            Return Return_Value
        End Function

        Public Function GetEventLog() As DataSet
            Return DSEventLog
        End Function
#End Region #Region " ClearAllEvent Method "
        Public Sub ClearAllEvent()
            SqlDataProvider.ExecuteQuery(_ConnectionString, "DM_WebEvent_ClearAllEvent", _
CommandType.StoredProcedure, Nothing)
        End Sub
#End Region
    End Class End Namespace

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“God could create the world in six days because he didn't have to make it compatible with the previous version.”