Get in touch today: 0800 133 7948 or Email us
Talk to an expert: hello@atlascode.com

How to install ELMAH, a .Net exception handler

Posted on: November 28th, 2010 by Simon Swords

ELMAH is an incredibly neat web development tool that attaches quickly and easily to any .Net website without needing to recompile the source and gives an incredibly useful overview of all unhandled exceptions that have  occured on the site.  Other errors such as 404’s are also displayed.

To get started with ELMAH follow these simple steps:

  1. Download ELMAH from http://code.google.com/p/elmah/
  2. Extract the contents and run the SQL script located in the db folder against your project database
  3. Open the Web.config.template folder which is located in samplesDemo.  This gives you an overview of the changes you need to make to your web.config file for ELMAH to work.
  4. When you’re done configuring your web.config copy the Elmah.dll for your version of .Net in to your bin folder.  Then attempt to load your website.
  5. Any errors displayed will almost certainly be as a result of errors in your web.config changes.
  6. If your site loaded successfully, chances are ELMAH is working.  Navigate to http://yoursite/elmah.axd and you should see the default ELMAH log page.
  7. Yourmay wish to hide your elmah page by either securing it using web.config or simply moving the location of the elmah page away from the default location.  This is easily done by updating the path attribute your web.config line:<add verb=”POST,GET,HEAD” path=”elmah.axd” type=”Elmah.ErrorLogPageFactory, Elmah”/>
  8. ELMAH provides a configuration section and setting to enable or disable remote access to the error log display and feeds. When disabled (the default), only local access to the error log display and feeds is allowed. The snippet below shows how to enable remote access:<elmah> �
    <security allowRemoteAccess=”1″ /> �
    </elmah>

We recommend using the RSS feeds and built in e-mail notifications to ensure that you’re always one step ahead of those pesky exceptions!

Simon Swords

Simon Swords

Director

Managing Director

Want to stay up to date with the latest software news, advice and technical tips?

Loading
;