使用Application_Error事件处理程序把异常记录到系统事件日志

 

using System.Diagnostics

protected void Application_Error(Object sender, EventArgs e)

        {

            EventLog.WriteEntry("FriendsReunion",

                Server.GetLastError().InnerException.Message,

                EventLogEntryType.Error);

        }

原文地址:https://www.cnblogs.com/ahuang1118/p/172562.html