I'm trying to redirect in case of an http error to a error page hosted in an external url making use of the element <httpErrors>
in my web.config file in server.
Currently I have the following configuration
<configuration>
<system.webServer>
<httpErrors errorMode="Custom" defaultResponseMode="Redirect">
<error statusCode="404" path="https://my-custom-error-page.com" />
</httpErrors>
...
and whatever I set as defaultResponseMode I cannot get the error page, and instead I'm still retrieving always the IIS error page.
someone knows what's missing?
Redirecting to custom error pages in Azure Application service doesn't work
web.config
is deployed in the wwwroot directoryCustomError
page with the below setting in web.config
when an error occurs<httpErrors existingResponse="PassThrough" />
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/public/404.html" responseMode="ExecuteURL" />
</httpErrors>
<system.webServer>
, Make sure you add<httpErrors existingResponse="PassThrough" />
wwwroot
folder created one folder named public and added the error.html page. Give the same path /public/404.html
in web.config