Trapping 404 and 500 errors in an MVC website web.config
There are two sections in the Web.config that need custom error handling settings.
How to redirect 404 and 500 errors with system.webServer httpErrors
In the system.webServer section, add an httpErrors node. First, remove the 404 and 500 statusCodes, then add them back, redirecting to custom message html files.