Question

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.

Was it helpful?

Solution

Try removing redirectMode="ResponseRewrite" attribute

CustomErrors does not work when setting redirectMode="ResponseRewrite"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top