Error Handling Techniques for ASP.NET

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
Just curious how some of you other guys handle unhandled errors in your ASP.NET applications...

1. Just throw the error and show a custom error page? Or worse the default error page?

2. Do a stack trace and put it in a log, or db, or email it? (What I do; however in release mode doesn't do a lot of good since I have no line numbers) and then do #1 or something else?

3. Catch all errors and just do nothing and leave the user thinking something was accomplished that wasn't? I hope not.

4. Redirect to a start page? Not very user friendly.

Reason I ask is I'm not really happy with my methods and wanted to do some personal research from the folks that visit here on what they do. Then while I wait on answer here I'll be Googling to see what suggestions I can find out there on the web?
 
I know this probably isn't very professional, but I generally include a hidden Label control that I will write error messages to and display whenever my form experiences errors. Generally, I include error prone routines in a try-catch block, and use the Exception Message as the Label's text with the note to kindly inform the webmaster (me).

Hopefully, that doesn't happen too often, though.
 
Back
Top