문제

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