Canvas
Canvas

Reputation: 5897

Catch all StatusCodes

Is there an easy way to catch multiple / all http status codes in the web config? At the moment I have

<customErrors mode="Off">
  <error statusCode="500" redirect="~/Account/Error"/>
  <error statusCode="404" redirect="~/Account/NotFound"/>
</customErrors>

but lets say I wanted to catch 501, 502, 503 and etc, is there no way I can do a range or handle all status codes? I would prefer not to hard code every single error if possible

Upvotes: 1

Views: 524

Answers (1)

Erez Robinson
Erez Robinson

Reputation: 784

Just add the defaultRedirect attribute to the customErrors tag. Search for examples like: http://tech.trailmax.info/2013/08/error-handling-in-mvc-and-nice-error-pages/

Upvotes: 3

Related Questions