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.

有帮助吗?

解决方案

Try removing redirectMode="ResponseRewrite" attribute

CustomErrors does not work when setting redirectMode="ResponseRewrite"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top