views:

55

answers:

1

Is there a better way to handle exceptions that occur inside an Action Filter itself in ASP .NET MVC?

There're 2 ways I can think of at the moment.

  1. Using a try catch and setting the HTTP Status Error code and message directly when an exception occurs
  2. Response.Redirect to the custom error page
A: 

You may implement IExceptionFilter to separate exception handling from the rest of the filter logic.

Darin Dimitrov