MVC 2 customErrors works locally but not live?
-
27-09-2019 - |
Question
Here is what I have in my web.config:
<customErrors mode="On" defaultRedirect="/pages/sitemap">
<error statusCode="404" redirect="/pages/sitemap" />
</customErrors>
Locally this works just as expected but live for some reason I still get the vanilla 404 error page?
I am using MVC 2 with Areas, thoughts?
Solution
Just a quick thought, have you tried adding the ~ to your redirects? Your application/directory structure is probably different on PROD than on your local test machine.
<customErrors mode="On" defaultRedirect="~/pages/sitemap">
<error statusCode="404" redirect="~/pages/sitemap" />
</customErrors>
Also, take a look if you have the something similar to the following snippet in your web.config
<httpErrors errorMode="DetailedLocalOnly">
<error statusCode="403" subStatusCode="4" path="custerr\403.4.htm" responseMode="File" />
</httpErrors>
This 'could' be overriding your settings.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow