Library code snippets
Health Monitoring in ASP.NET 2
- Installing & Configuring
- WebEvents Class
- Event Class
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
Get
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)
("ApplicationPath"))
.ApplicationVirtualPath = IIf(DSEventLog.Tables(0).Rows(Index) _
("ApplicationVirtualPath") Is DBNull.Value, vbNullString, _
DSEventLog.Tables(0).Rows(Index)("ApplicationVirtualPath"))
.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) _
("ExceptionType"))
.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
Related articles
Related discussion
-
Profile Class does not work after Translation
by converter2009 (1 replies)
-
what is the SQL Server Provider
by hayperaktib (1 replies)
-
Very Urgent regarding deleting the images from a folder
by Nanosteps (6 replies)
-
Java Script, File uploading on ftp server using java script code
by h_c_a_andersen (2 replies)
-
sharepoint calendar web part with events from sql table
by converter2009 (2 replies)
Related podcasts
-
StackOverflow uses ASP.NET MVC - Jeff Atwood and his technical team
Scott chats with Jeff Atwood of CodingHorror.com and most recently, StackOverflow.com. Jeff and Joel Spolsky and their technical team have created a new class of application using ASP.NET MVC. What works, what doesn't, and how did it all go down?
Events coming up
-
Mar
15
DevWeek 2010
London, United Kingdom
DevWeek is Europe’s leading independent conference for software developers, database professionals and IT architects, and features expert speakers on a wide range of topics, including .NET 4.0, Silverlight 3, WCF 4, Visual Studio 2010, REST, Windows Workflow 4, Thread Synchronization, ASP.NET 4.0, SQL Server 2008 R2, LINQ, Unit Testing, CLR & C# 4.0, .NET Patterns, WPF 4, F#, Windows Azure, ADO.NET, Entity Framework, Debugging, T-SQL Tips & Tricks, and more.
Hi Mehdi Golchin,
Thanks for you guide. I have successed to configure the aspnet_regsql.
regard,
Jason
Hi Jason,
Health monitoring uses SQL Server for storing web events. so you must add health monitoring's tables and stored procedures. for that you have tow solutions. you can use aspnet_regsql command in visual studio command prompt or if you like to create a installation page for your project you can use
that code which generates health monitoring's tables and stored procedures as run-time.
Dear Mehdi Golchin,
With regard to your Step 1, can you please explain more in details "run-time mode". As i do not know where to install it Many thanks...
Step 1 : Installing Web Event
You can do this easily in run-time mode with this code below:
This thread is for discussions of Health Monitoring in ASP.NET 2.