Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

You receive a default error message when you set custom errors in a Web application that is built on the .NET Framework


View products that this article applies to.

Symptoms

When you run a Web application that is built on the Microsoft .NET Framework, you may unexpectedly receive the following generic error message even though you specified a custom error page in the Web.config file:
Server Error in '/deneme1' Application.
--------------------------------------------------------------------------------

Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.

Details: To enable the details of this specific error message to be viewable on the local server machine, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".
<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly"/>
    </system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="On" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

↑ Back to the top


Cause

This issue occurs when a custom error page in the application also contains an error.

↑ Back to the top


Resolution

To resolve this issue, specify one of the following pages as the custom error page for the application:
  • A static page
  • A page that exists outside the application

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

Custom error pages in Web applications that are built on the .NET Framework are displayed only if the mode value of the customErrors element in the Web.config file is set to On or RemoteOnly.

For example, you can use the following code in the Web.config file.
<configuration>
    <system.web>
        <customErrors mode="RemoteOnly"/>
    </system.web>
</configuration>
For more information about how to create custom error pages in Microsoft ASP.NET, click the following article numbers to view the articles in the Microsoft Knowledge Base:
308132 How to create custom error reporting pages in ASP.NET using Visual Basic .NET
306355 How to create custom error reporting pages in ASP.NET by using Visual C# .NET

↑ Back to the top


Keywords: KB910434, kbprb

↑ Back to the top

Article Info
Article ID : 910434
Revision : 4
Created on : 2/10/2006
Published on : 2/10/2006
Exists online : False
Views : 341