Reputation: 7264
I'm using MVC2.
My webconfig says
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/internal-server-error">
<error statusCode="500" redirect="~/internal-server-error" />
<error statusCode="404" redirect="~/not-found" />
</customErrors>
My test method says
public ActionResult ErrorTest()
{
var z = 0;
var x= 3/z;
return null;
}
I still get the default Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.
, instead of my custom error method, which is not even called.
Why? Is this a dev server issue? Will it work on IIS?
EDIT: Tried it on IIS Express as well, commented out the whole Application_Error
in Global.asax.cs
, still not working.
Upvotes: 2
Views: 5429
Reputation: 5802
Try removing redirectMode="ResponseRewrite"
attribute
CustomErrors does not work when setting redirectMode="ResponseRewrite"
Upvotes: 3