I'm trying to execute my custom error controller action when a user tries to visit a non-existing URL. I've added this:
<httpErrors errorMode="Custom" existingResponse="PassThrough">
<remove statusCode="404"/>
<error statusCode="404" path="error/404-not-found" responseMode="ExecuteURL"/>
</httpErrors>
I also have a controller for errors, and I confirm that /error/404-not-found
is accessible (I see the correct error page). However, when I try to visit a non-existent URL, I'm still getting the regular "Server error in / Application" 404 error instead of my custom error page. I've also tried different existingResponse and responseMode values but no avail. How do I get my 404 errors redirect to my page?