Wednesday November 25th

Reporting Exceptions through E-Mail

One of the terrible things we as developers have to deal with is unhandled exceptions, we all have them good and bad developers. The problem is that no matter how well thought out an application may be we will always have holes that we never anticipated. Unfortunately one day an end user will find it and our application will ungracefully blow up. This article is a simple error reporting routine to e-mail exception details.


What if the Exception is caused by the SMTP server? ;-)

if the smtp fails i usually write it to a file or event log

In my experience email is a bad idea if your exception handling is in a loop or you have large amounts of traffic to a page in error. It would be better to log to a db or text file and monitor for new errors with some sort of alert, possibly email.

Why not use the Exception Handling block of the Enterprise Library? That way you can define policies at runtime (simple web.config update) without rewriting code.

Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network