Thu 15 Apr 2010

To view the detailed error information for generic error against 500 Internal Server Error

internal+server+error.jpg

By default, Windows hosting servers display a generic error when any .NET application generates an exception. They display a generic error because the detailed error messages allow a malicious user to obtain sensitive information.

To troubleshoot the error, you can modify your web.config file and specify that a custom error message displays. A custom error message helps you to locate the specific code that is causing the issue.

CAUTION: The code samples we provide below do not constitute a complete web.config file. Do not replace your existing web.config file with the code we provide. Before changing your web.config file, we recommend creating a backup.

 

Displaying Custom Error Messages / Enabling Detailed Errors on IIS 6

Use the sample code below to display custom error messages on IIS 6:

<configuration>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>



Displaying Custom Error Messages / Enabling Detailed Errors on IIS 7

Use the sample code below to display custom error messages on IIS 7:

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>
    </system.webServer>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>

 

=========================

 

Tags:
E-mail this post to someone or Comments here