4

How do you even look at the web.config file? I don't know where to go to turn custom errors off...help!

I tried command prompt and java script....can any one help me?

1
  • Could you explain this further please? What do you mean that you want to look at the web.config file? Do you mean via a web browser? If so, you should know that IIS prevents you from seeing config files by default - it's a forbidden type. Dec 10, 2008 at 15:36

3 Answers 3

16

Keep in mind that IIS errors and asp.net errors are two separate things,

For remote requests, by default IIS has custom errors enabled, what that means is if you are returning a none 200 response from your application, IIS will discard the body you were sending back and replace it with its own custom page. which can be pretty troubling if you are hosting a REST service that needs to return error details to the client as json or XML.

to turn off ASP.net custom errors use customErrors Element (ASP.NET Settings Schema)

to turn off IIS custom errors use IIS HTTP Errors httpErrors

3
  • Wow this is the first time I heard about that distinction, thanks! Sep 7, 2012 at 22:31
  • Is this enough to show detailed error even from remote clients: <httpErrors errorMode="Detailed"></httpErrors> Sep 7, 2012 at 22:33
  • Both methods to disable ASP.NET and IIS own errors are not working with a WCF Application hosted in IIS (Net framework 4.7.2)
    – Oliver
    Sep 30, 2021 at 0:10
8

Run the Internet Information Services (IIS) Manager tool from the Administrative Tools (on the start menu if admin tools are enabled there). Open up the system, and right click on your web site. Select Properties. Choose the ASP.NET tab. Click on "Edit Configuration". Click the Custom Errors tab. Select Off for custom error mode.

Or navigate to the folder containing your application and open the web.config file in a text editor and edit by hand, and change the custom errors tag to <customErrors mode="Off" />.

5

Per the MSDN documentation the valid values for mode are:

On: Specifies that custom errors are enabled. If no defaultRedirect attribute is specified, users see a generic error. The custom errors are shown to the remote clients and to the local host.

Off Specifies that custom errors are disabled. The detailed ASP.NET errors are shown to the remote clients and to the local host.

RemoteOnly Specifies that custom errors are shown only to the remote clients, and that ASP.NET errors are shown to the local host. This is the default value.

The default is RemoteOnly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy