Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC 3 Custom Errors Not Showing

From a fresh MVC 3 Project, I've modified an Index() action to throw an exception. I expect the stock Error.chhtml view to be rendered, because I've set <customErrors mode="On" /> in the web.config. Instead, I still get the "yellow screen of death" while running from within VS.

<system.web>
  <customErrors mode="On" />
  ...

My HandleError attribute is set globally from the global.asax.cs.

    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new HandleErrorAttribute());
    }

...unmodified, per the default project setup. I've run against both IIS express and VS Dev Server. Nothing causes the custom error page to surface. What am I missing?

like image 677
Brent Arias Avatar asked May 23 '11 04:05

Brent Arias


1 Answers

I have seen the same problem, which is due to that I added <customErrors mode="On" /> to <root>\Views\Web.config, instead of <root>\Web.config

like image 191
engineforce Avatar answered Nov 11 '22 15:11

engineforce