IIS 7 & IIS 8
why do i have to add <httpErrors> in web.config?
Last post Mar 06, 2013 07:24 AM by Chen Yu - MSFT
Mar 04, 2013 02:52 PM|LINK
Do I have to include the httpErrors in web.config if i want to have my own custom pages?
Hi: I am having something weird going on with my web app. I have a customError set in place already
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="~/errors/404.aspx" />
So right now, if i enter a bogus page, site/abcd.aspx, it will hit my customized error page, but if i enter an extensionless bad page, like site/wrongpage , it will hit the IIS default page.
We are using a CMS, so I configured that accordingly. But I am still seeing the problem.
Do I need to add the following in order for it to take care of the extensionless web pages as well?
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/errors/404.aspx" responseMode="ExecuteURL" />
my co worker added that, and told me it is working OK now. But why? can someone explain to me why I need to add the ? I'd appreciate all your gurus help out there in advance.
Mar 06, 2013 07:24 AM|LINK
The <httpErrors> element allows you to configure custom error messages for your Web site or application. You can add custom error messages to IIS by adding an <error> element to the <httpErrors> element in the Web.config file for your site, application,
or URL. Each <error> element uses the responseMode attribute to specify whether IIS serves static content, dynamic content, or redirects to a separate URL in response to an error.
You could check below article to know more about HTTP Errors: