Writing to eventLog from ASP
Thought of blogging bits of code I use daily at work..so that I[..hmm ofcourse you too] can refer them in future...
Today I had to write some events from ASP page in to eventlog..after refering some articles..we came up with 3 methods..
1. Log using COM component
2. Using Windows script Host
3. WMI
I tried the first 2. For COM component create a VB activeX dll and code the following.
Function LogEvent(Dim strError As string, Dim EventType as integer) AS Boolean
App.LogEvent strError, EventType
End Function
Then from ASP use server.CreateObject and call this component to log. As simple as that.
For second method just use server.CreateObject("Wscript.shell") from ASP and call LogEvent method of that instance.
Thats it!
Today I had to write some events from ASP page in to eventlog..after refering some articles..we came up with 3 methods..
1. Log using COM component
2. Using Windows script Host
3. WMI
I tried the first 2. For COM component create a VB activeX dll and code the following.
Function LogEvent(Dim strError As string, Dim EventType as integer) AS Boolean
App.LogEvent strError, EventType
End Function
Then from ASP use server.CreateObject and call this component to log. As simple as that.
For second method just use server.CreateObject("Wscript.shell") from ASP and call LogEvent method of that instance.
Thats it!

0 Comments:
Post a Comment