i have 2 questions :
1)i tried to use this code :
Public Sub Write2EventViewer(ByVal errorMessage As String)
Dim strSource As String = "MyWebSite" 'name of the source
Dim strLogType As String = "Application" 'type of the log 'Application
Dim strMachine As String = "." ' //machine name
If EventLog.SourceExists(strSource, strMachine) = False Then
System.Diagnostics.EventLog.CreateEventSource(strSource,
strLogType)
End If
Dim MyLog As New EventLog(strLogType, ".", strSource)
MyLog.WriteEntry(errorMessage, EventLogEntryType.Warning)
End Sub
in the begining i assume i did some mistake and now the error instead of
appearing under Application ,with source=MyWebSite
i have a new log EVENT under application which called MyWebSite
and the error are written to there.
how can i fix this so it will appear under application?
2)how can i create a dll from this code and use it in my asp.net web site
project?
thnaks in advnace
peleg
Manish Bafna - 28 Jul 2007 09:08 GMT
Hi,
Why create dll?.Instead you can create a public class which encapsulates
your log.Below link shows how to create public class which encapsualates your
logic and which you can use anywhere in the project:
http://www.dotnetspider.com/code/C-240-Write-Event-Log.aspx

Signature
Hope this answers your question.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
> i have 2 questions :
> 1)i tried to use this code :
[quoted text clipped - 25 lines]
> thnaks in advnace
> peleg