maxp
maxp

Reputation: 25161

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?

Upvotes: 1

Views: 123

Answers (4)

ram
ram

Reputation: 11626

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

Upvotes: 1

Prutswonder
Prutswonder

Reputation: 10074

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.

Upvotes: 2

John Saunders
John Saunders

Reputation: 161821

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.

Upvotes: 1

Lars Mæhlum
Lars Mæhlum

Reputation: 6102

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

Upvotes: 6

Related Questions