I've developped a sharepoint 2007 feature in vb.net. Inside, have an application page and in onload method, i want to write message in event log
Dim cs As String = "TESTLOG"
Dim elog As New EventLog()
Dim sourceExist As Boolean
Try
sourceExist = EventLog.SourceExists(cs)
Catch ex As Exception
sourceExist = False
End Try
If Not sourceExist Then
Dim ev As New EventLogPermission(EventLogPermissionAccess.Administer, ".")
ev.PermitOnly()
EventLog.CreateEventSource(cs, "TESTLOG")
End If
elog.Source = cs
elog.EnableRaisingEvents = True
EventLog.WriteEntry(cs, message, EventLogEntryType.[Error])
The source is correctly created but when i try to write, i've an access denied. I go to registry to set permission full control at everyone but still have the message. HKEY_LOCAL_MACHINE SYSTEM CurrentControlSet Services Eventlog Application
How can i write message in event log?
Thanks