Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads
 
Add your own
alternative version

User Friendly ASP.NET Exception Handling

, 20 Dec 2004
A flexible framework for user-friendly ASP.NET exception handling, and automatically notifying developers of problems before users do.
ASPNETExceptionHandling_demo.zip
WebServiceTestConsoleApplication
bin
Web References
WebReference
Reference.map
service1.disco
service1.wsdl
ASPUnhandledException
bin
wwwroot$.zip
What is it?

This HTTP module implements global Unhandled Exception notification for any ASP.NET website, 
or any ASP.NET Web Service, without recompilation. When your application encounters an Unhandled 
Exception, you get the following for free:

 - a "user friendly" exception web page
 - an email notification 
 - a plain text logfile 
 - Event Log logging
 
How do I set it up?

This is the Quick Start. Refer to source headers for more options and details.

1) put ASPUnhandledException.dll in the /bin folder

2) Add these configuration options to the <appSettings> section of your Web.config

	<configSections>    
		<section name="UnhandledException" type="System.Configuration.NameValueSectionHandler, 
			System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
	</configSections>

	<UnhandledException>
  		<add key="EmailTo" value="me@domain.com;you@domain.com" />	
		<add key="ContactInfo" value="Ima TestGuy at 919-555-1212" />
		<add key="IgnoreRegex" value="get_aspx_ver\.aspx" />
		<add key="SmtpDefaultDomain" value="mydomain.com" />
		<add key="SmtpServer" value="mail.mydomain.com" />
	</UnhandledException>

3A) for an ASP.NET website, modify the <system.web> section of your Web.config

  <system.web>
	<!-- Adds our error handler to the HTTP pipeline -->
	<httpModules>
	  <add name="UehHttpModule" 
	       type="ASPUnhandledException.UehHttpModule, ASPUnhandledException" />
	</httpModules>
  </system.web>
  
2B) for an ASP.NET Web Service, modify the <webServices> section of your Web.config:

  <webServices>
	<!-- Adds our error handler to the SOAP pipeline -->
	<soapExtensionTypes>
	  <add type="ASPUnhandledException.UehSoapExtension, ASPUnhandledException"
	       priority="1" group="0" />
	</soapExtensionTypes>
  </webServices>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

wumpus1
Web Developer
United States United States
My name is Jeff Atwood. I live in Berkeley, CA with my wife, two cats, and far more computers than I care to mention. My first computer was the Texas Instruments TI-99/4a. I've been a Microsoft Windows developer since 1992; primarily in VB. I am particularly interested in best practices and human factors in software development, as represented in my recommended developer reading list. I also have a coding and human factors related blog at www.codinghorror.com.

| Advertise | Privacy | Mobile
Web02 | 2.8.141022.1 | Last Updated 21 Dec 2004
Article Copyright 2004 by wumpus1
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid