Posted on: 4/8/2011 12:04:32 PM | Views : 437

I have a web page with couple of textboxes and a button. User enter the remote server name, serach string and date range and press button. It popup a window with the event log data. I have used the following code to get the event viewer data from the server. It works well for the local event log but fails for remote user.
private ArrayList GetEventLogs(string machinename, string searchtext, DateTime fromdate, DateTime todate) { string logType = "Application"; using (EventLog ev = new EventLog(logType, machinename)) { int LastLogToShow = ev.Entries.Count; if (LastLogToShow <= 0) Console.WriteLine("No Event Logs in the Log :" + logType); var result = from EventLogEntry elog in ev.Entries where (elog.TimeWritten > fromdate && elog.TimeWritten < todate) && elog.Message.Contains(searchtext) orderby elog.Tim ...

Go to the complete details ...