I've got this in the web.config:
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/Error/NotFound.aspx" responseMode="Redirect" />
<error statusCode="500" prefixLanguageFilePath="" path="/Error/ServerError.aspx" responseMode="Redirect" />
</httpErrors>
But IIS still shows the built in error page.
Any ideas?
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.
Within the text box, “File path,” type the URL of the custom error page, and then click “OK.” Note: Make sure when selecting this option that the path is a relative path. Once you hit “OK,” your custom 404 error page should be live and doing its job.
Custom error pages enable you to customize the pages that display when an error occurs. This makes your website appear more professional and also prevents visitors from leaving your site. If a visitor sees a generic error page, they are likely to leave your site.
You may also need to set the existingReponse attribute in the httpErrors element like this:
<httpErrors errorMode="Custom" existingResponse="Replace">
<clear />
<error statusCode="404" prefixLanguageFilePath="" path="/ErrorHandler.aspx" responseMode="ExecuteURL" />
<error statusCode="500" prefixLanguageFilePath="" path="/ErrorHandler.aspx" responseMode="ExecuteURL" />
</httpErrors>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With