For this experiment, I have used a new web application on visual studio 2008.

1. Download latest version from http://elmah.googlecode.com/

2. Reference the Elmah.dll file from the downloaded files (Eg: \ELMAH-1.0-BETA3-bin\bin\net-3.5\Elmah.dll)

3. Add below code in your web.config file - under configuration node:

    <br /><sectiongroup name="elmah">
 
    <br /><section name="security" type="Elmah.SecuritySectionHandler, Elmah" requirepermission="false" />
 
    <br /><section name="errorLog" type="Elmah.ErrorLogSectionHandler, Elmah" requirepermission="false" />
 
    <br /><section name="errorMail" type="Elmah.ErrorMailSectionHandler, Elmah" requirepermission="false" />
 
    <br /><section name="errorFilter" type="Elmah.ErrorFilterSectionHandler, Elmah" requirepermission="false" />
 
    <br /></sectiongroup>
 
    <br />

4. Now add http handler - in the node:

    <br /><add type="Elmah.ErrorLogPageFactory, Elmah" path="elmah.axd" verb="POST,GET,HEAD" />

5. Now enable the logging feature. For that add the below line in node:

    <br /><add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />

In this point you can test the error page: http://yourhost/yoursite_path/elmah.axd

6. Default storage of errors will be ‘memory’ you can choose other available methods also - XML files, SQLLite and SQL Server. Here I will use SQL Server.

7. Add this inside node. Make sure you have a valid connection string already defined.

    <br /><errorlog type="Elmah.SqlErrorLog, Elmah" connectionstringname="Your_Connection_String_Name" />

8. Execute the \ELMAH-1.0-BETA3-bin\db\SQLServer.sql file from SQL Server Management studio.

9. Everything done. There are many options available. Research!


Additional notes:

If you use URL re-writing features in asp.net then you willl have to use this also in web.config:

  <location path="elmah.axd">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>

You can ask questions here: http://kidoos.net/forums/t/213.aspx

VN:F [1.1.6_502]
Rating: 4.5/5 (2 votes cast)
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati

Related posts:

  1. Error Logging Modules and Handlers - Elmah
  2. A simple ISAPI extension with C#
  3. Simple WPF ViewModel implementaion with VisualBasic.NET
  4. ASP.NET 4.0 – new features
  5. Connection Pooling error.