Partilhar via


Change the Status Code for an HTTP Error Response (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

Change the status code for an HTTP error response when you want to change the HTTP error for which your custom error response is returned.

Note

You cannot customize the following HTTP errors: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505.

Prerequisites

For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see HTTP Error Responses Feature Requirements (IIS 7).

Exceptions to feature requirements

  • None

To change the status code for an HTTP error response

You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.

User Interface

To use the UI

  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).

  2. In Features View, double-click Error Pages.

  3. On the Error Pages page, click to select the custom error page for which you want to change the status code.

  4. In the Actions pane, click Change status code.

  5. On the Error Pages page, in the Status Code column, enter the new status code and then click anywhere on the page.

Command Line

To <do_something>, use the following syntax:

appcmd command object parameter:value | parameter:variable | parameter:option1 | option2

The variable <variable_name> is <description_of_variable>. For example, to <do_something_specific>, type the following at the command prompt, and then press ENTER:

appcmd <exact_command_to_accomplish_the_procedure>

Note

When you use Appcmd.exe to configure the <element_name> element at the global level in IIS 7, you must specify /commit:WEBROOT in the command so that configuration changes are made to the root Web.config file instead of ApplicationHost.config.

For more information about Appcmd.exe, see Appcmd.exe (IIS 7).

Configuration

The procedure in this topic affects the following configuration elements:

<httpErrors>

For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.

See Also

Concepts

Configuring HTTP Error Responses in IIS 7
View a List of HTTP Error Responses (IIS 7)
Create a Custom HTTP Error Response (IIS 7)
Edit a Custom HTTP Error Response (IIS 7)
Remove a Custom HTTP Error Response (IIS 7)