Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • ELMAH in .NET

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 30
    Comment on it

    Error Logging and Management Handling in .NET is a technique by which errors are logged into database.


    For doing this first you need to download DLL called Elmah.dll


    Then write this code in your Web.Config file.


    <?xml version="1.0"?>
    <configuration>
      <configSections>
        <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>
      </configSections>
      <connectionStrings>
        <add name="elmah-express" connectionString="Server=KAZOL-PC\SQLEXPRESS08;
        Database=Elmah&#95;Errorlog;Trusted&#95;Connection=Yes;" />
      </connectionStrings>
      <elmah>
        <errorLog type="Elmah.SqlErrorLog, Elmah"
                 connectionStringName="elmah-express" />
        <errorFilter>
          <test>
            <equal binding="HttpStatusCode" value="404" valueType="Int32" />
          </test>
        </errorFilter>
      </elmah>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
        <httpHandlers>
          <add verb="POST,GET,HEAD" path="elmah.axd"
        type="Elmah.ErrorLogPageFactory, Elmah" />
        </httpHandlers>
        <httpModules>
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
        </httpModules>
      </system.web>
    </configuration>
    


    And in the code behind throw an error for testing it


    throw new Exception("test");
    


    Then on URL type MyPage.axd


    Error with log will appear

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: