S
Scott Vercuski
Everyone,
I'm having trouble writing an event to the event log. Here is the
chunk of code I currently have.
-----------------------------------------------------------------------
Private Shared Function WriteErrorToLog(ByVal objError As
System.Text.StringBuilder, ByVal strSource As String) As Boolean
Dim objEL As New EventLog
Dim blnreturnvalue As Boolean
Dim Response As System.Web.HttpResponse
Response = System.Web.HttpContext.Current.Response
Try
If objEL.SourceExists(strSource) = False Then
objEL.CreateEventSource(strSource, "Application")
End If
objEL.Source = strSource
objEL.WriteEntry(objError.ToString(),
EventLogEntryType.Error)
blnreturnvalue = True
Catch ex As Exception
Response.Write("MSG: " & ex.Message & "<br>")
Response.Write("ST: " & ex.StackTrace & "<br>")
blnreturnvalue = False
End Try
Return blnreturnvalue
End Function
-----------------------------------------------------------------------
When I call this function I see the following error ...
MSG: Cannot open log for source {0}. You may not have write access.
I'm at a complete loss as to what's going on?? has writing to the
event log become such a chore now?? this is a little crazy ... I've
been at this for a day or so. I've tried switching the impersonate
setting (right now it's at false), permissions on the ASP.NET account,
the IUSR account etc ... I'm running out of ideas.
Thanks in advance for any assistance !
Scott Vercuski
(e-mail address removed)
I'm having trouble writing an event to the event log. Here is the
chunk of code I currently have.
-----------------------------------------------------------------------
Private Shared Function WriteErrorToLog(ByVal objError As
System.Text.StringBuilder, ByVal strSource As String) As Boolean
Dim objEL As New EventLog
Dim blnreturnvalue As Boolean
Dim Response As System.Web.HttpResponse
Response = System.Web.HttpContext.Current.Response
Try
If objEL.SourceExists(strSource) = False Then
objEL.CreateEventSource(strSource, "Application")
End If
objEL.Source = strSource
objEL.WriteEntry(objError.ToString(),
EventLogEntryType.Error)
blnreturnvalue = True
Catch ex As Exception
Response.Write("MSG: " & ex.Message & "<br>")
Response.Write("ST: " & ex.StackTrace & "<br>")
blnreturnvalue = False
End Try
Return blnreturnvalue
End Function
-----------------------------------------------------------------------
When I call this function I see the following error ...
MSG: Cannot open log for source {0}. You may not have write access.
I'm at a complete loss as to what's going on?? has writing to the
event log become such a chore now?? this is a little crazy ... I've
been at this for a day or so. I've tried switching the impersonate
setting (right now it's at false), permissions on the ASP.NET account,
the IUSR account etc ... I'm running out of ideas.
Thanks in advance for any assistance !
Scott Vercuski
(e-mail address removed)