To retrieve error message or warning message from Windows event log in ASP.NET 2.0 and C# is very simple. This tutorial will show you how to get the error message from event log.

At first, import the namespace of System.Diagnostics

Use looping to retrieve all error message from event log

If you want get the information or warning messages from event log, just use EventLogEntryType.Information or EventLogEntryType.Warning to replace EventLogEntryType.Error

The flow for the code behind page is as follows.

Download Source Files