OdeToCode IC Logo

When Your ASP.NET MVC Custom Error Doesn't Render...

Wednesday, June 16, 2010

The so-called Yellow Screen of DeathYou've put [HandleError] on your controller and you've set <customErrors mode="On"> in the web.config file. So why do you still see the yellow screen of death?

I've heard various wrong explanations for this phenomena, including "it only works under IIS" and "it only works in release mode". But the custom error view does work in debug mode and it does work with the Visual Studio WebDev web server. I think the most common reason for the error view not to display is because the error view throws an uncaught exception.

The first place to check when the error view doesn't render is in the error view itself. Make sure there isn't any code that might dereference a null reference, for instance, and run with debugging enabled to make sure.