views:

71

answers:

4

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?

+6  A: 

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

Lars Mæhlum
Sweet, I didnt know about this project. Thanks.
Development 4.0
Wow, the summary sounds fantastic.
maxp
Another vote for Elmah. I've used it in various projects in the past and it works well. The only limitation I haved found is that you have to create your own custom handler in order to have elmah log to the windows event log if that is a requirement.
Brian Scott
+1  A: 

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.

John Saunders
+2  A: 

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.

Prutswonder
log4net supports email too.
Hightechrider
+1  A: 

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

ram