Reading event log – Only exception part
Here is the few line code
try
{
int intCount = 1;
EventLog EventLog1 = new EventLog();
EventLog1.Log = “Application”;
//EventLog1.MachineName = “SERVER1″;
int intLatestIndex = EventLog1.Entries.Count;
int idx = EventLog1.Entries[intLatestIndex - 1].Message.IndexOf(”Exception information”);
Response.Write(EventLog1.Entries[intLatestIndex - 1].Message.Substring(idx).Replace(”\n”, “
“));
intCount++;
}
catch (Exception exp)
{
}
