Search code examples
asp.netexceptionweb-config

Custom Errors tag not working[Server Error in '/' Application.]


I don't want to remove the error, I just want to hide this error (Server Error in '/' Application). but in web.config my (customErrors mode="Off") is not working .

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

This is the error when i applied customErrors mode= "Off"

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.


Solution

  • Without seeing the rest of your configuration file it's not possible to know what is wrong with it but apart from that I think you are misunderstanding what <customErrors mode="Off"/> does. It will actually show the most detailed "yellow screen of death" of all the custom error modes. From here:

    CustomErrors supports the following modes:

    • On – If defaultRedirect is specified, they will see that content. Otherwise the default error screen with fewer details.
    • Off – Detailed error details will be shown to the user. (the “yellow screen of death screen”)
    • RemoteOnly – Default value. Detailed errors only are shown to local users. Remote users receive custom error screens or fewer
      details.