Reading EventLog C# Errors

Posted by Robert on Stack Overflow See other posts from Stack Overflow or by Robert
Published on 2010-04-13T21:48:43Z Indexed on 2010/04/13 21:53 UTC
Read the original article Hit count: 764

Filed under:
|
|

I have this code in my ASP.NET application written in C# that is trying to read the eventlog, but it returns an error.

EventLog aLog = new EventLog();
aLog.Log = "Application";
aLog.MachineName = ".";  // Local machine

foreach (EventLogEntry entry in aLog.Entries)
{
 if (entry.Source.Equals("tvNZB"))
     Label_log.Text += "<p>" + entry.Message;
}

One of the entries it returns is "The description for Event ID '0' in Source 'tvNZB' cannot be found. The local computer may not have the necessary registry information or message DLL files to display the message, or you may not have permission to access them. The following information is part of the event:'Service started successfully.'"

I only want the 'Service started successfully'. Any ideas?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET