Slee
Slee

Reputation: 28248

MVC 2 customErrors works locally but not live?

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?

Upvotes: 1

Views: 323

Answers (1)

Tommy
Tommy

Reputation: 39807

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.

Upvotes: 1

Related Questions