
<globalization> | 445
web.config
Reference
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Scope
Any
Attributes
statusCode
Specifies the HTTP status code (such as 404 for a “Not Found” error) for the
specified custom error page. This attribute is optional.
redirect
Specifies the URL of the page to which requests with a matching HTTP status
code should be redirected. This attribute is optional.
Child Elements
None
Example
The example configures a custom error page for 404 errors, and the default error
page configured in the previous example:
<configuration>
<system.web>
<customErrors
defaultRedirect="Error.aspx">
<error statusCode="404" redirect="My404ErrorPage.aspx"/>
</customErrors>
</system.web>
</configuration>
Notes
While custom error pages provide a convenient way to prevent users from seeing
raw error messages (and perhaps provide more helpful messages), they are not a
substitute for proper exception handling. By the time an error reaches a custom
error page, recovering from the error gracefully will be much more difficult, which
can degrade the experience of your users.
<globalization>
<globalization
requestEncoding=encodingString
responseEncoding=encodingString
fileEncoding=encodingString
culture=cultureString
uiCulture=cultureString />
Provides attributes for configuring encoding and culture settings. These attributes
are used as the ...