in

Share your IT thoughts...

I N F O R M A T I O N   T E C H N O L O G Y   P O R T A L   O F   E X P E R T S
Latest post Wed, May 13 2009 5:02 AM by NinethSense. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • Wed, May 13 2009 5:02 AM

    • NinethSense
    • Top 10 Contributor
    • Joined on Tue, Jul 1 2008
    • India
    • Master
    • Points 7,887

    ELMAH integration to ASP.NET in simple steps

    This is an on-demand post.  Original post you can find here.

    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:

     

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

     

    4. Now add http handler - in the node:

     

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

     

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

     

        
    <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.

     

        
    <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>
          
        
      
    
    • Post Points: 15
Page 1 of 1 (1 items)