Michel
Michel

Reputation: 23615

When i add a custom error page, do i return the error status code also?

i've created a general exception handler in de the global_asax.

In there i log the exception, and redirect to /error

In that controller, i show the view with a friendly message, and i also set the Response.StatusCode = 500;

And now i'm wondering if that is ok....

In my localhost cassini this works fine, but when deployed on IIS i get the standard IIS 500 page and not my custom friendly view.

Is that by design?

Upvotes: 0

Views: 54

Answers (1)

mfanto
mfanto

Reputation: 14418

Try setting the TrySkipIisCustomErrors property in your error handler:

Response.TrySkipIisCustomErrors = true;

It will prevent IIS error pages from getting in the way. Also, make sure you've correctly configured customErrors in Web.config

Upvotes: 1

Related Questions