Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

EventViewer using

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pelegk1 - 28 Jul 2007 07:50 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.