开发者

Handling errors in ASP.NET

A few questions on handing errors- I assume it's best to handle them in Application_OnError(){}?

Do you then prefer to write them error to the event log, write them开发者_运维技巧 to a custom file locally or email them?

If the latter, do you use any specialist libraries to pre-format the exception email?


Have a look at ELMAH: http://code.google.com/p/elmah/


For some applications we use Log4Net, for others we use the EnterpriseLibrary Logging Application Block. They both can write the errors to a log file in a predefined format. The Logging Application Block also supports sending the error by email. Well worth checking out.


If you take no action at all, ASP.NET Health Monitoring will log the errors for you. By default it will log to the Windows Event Log.


you should also handle "unhandled exceptions". see here . YOu can read more about it in MSDN

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜