MVC HandleError returns a 500 error and displays an error page

I am using MVC 3 with VS2010 and trying to get [HandleError] working. I created a test in the controller to simulate a failure as follows:

[HandleError]
public ActionResult Crash()
{
    throw new ApplicationException();
}

Also logged into web.config and added:

<customErrors mode="on" />

If I run from Chrome, MVC returns the view in Shared / Error.aspx, so this is normal.

If I run from IE 8, I get its page with a friendly error ("The website cannot display the page, most likely the reasons: ... What you can try ..."). I went into IE Tools and turned off "Show friendly HTTP error message" and started again, and IE shows my view of Error.aspx. Obviously, I cannot force users to change this parameter, but at least I know that my Error.aspx is being returned.

, Fiddler, Crash, , , MVC Error.aspx, 500 . IE , .

, MVC 200 Error.aspx, 500. - , ?

+3
1

> 512 , . IE, , .

+8

Source: https://habr.com/ru/post/1795134/


All Articles