luisgepeto
luisgepeto

Reputation: 813

Yellow screen on local vs Handle Error on remote

I am working on an MVC application where I want to display custom error pages and avoid to show a yellow screen of death on errors. I have added the HandleError filter on my global filters configuration.

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

I have also changed the values of the web.config to enable custom errors.

<customErrors mode="On" />

Right now, my application is succesfully redirecting to my custom error screen. However, what I want is to be able to see the yellow screen of death when the application is being run locally. is there any way of accomplishing it? Im guessing maybe override the OnException method of the HandleError filter so that we can stop the method from redirecting to the Error view, but I do not know how to do this.

Upvotes: 0

Views: 844

Answers (1)

Jamie Dixon
Jamie Dixon

Reputation: 53991

If you change the customErrors mode from On to RemoteOnly then you'll be presented with the yellow error screen whilst testing locally.

<customErrors mode="RemoteOnly">
</customErrors>

You can read more about the customeErrors element here: http://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.85).aspx

Upvotes: 1

Related Questions