Is it possible to use ExceptionFilterAttribute in a project the was created with MVC2 and upgraded to MVC4? It is not a Web API project, and I cannot seem to get the exception to catch using the ExceptionFilterAttribute. Is there any way to make this happen or am I better off just sticking to inheriting from ActionFilterAttribute and implementing IExceptionFilter. This is for an API section within our MVC project
Asked
Active
Viewed 2,159 times
2
1 Answers
3
MVC attributes and Web API attributes are not compatible.
MVC ones are of System.Web.Mvc.Filter
type [1], while Web API are of System.Web.Http.Filters.Filter
type [2] - so you need to make sure you get your base class correct before trying to apply the attribute to Web API.
[1] - http://msdn.microsoft.com/en-us/library/system.web.mvc.filter(v=vs.98).aspx
[2] - http://msdn.microsoft.com/en-us/library/system.web.http.filters.filter(v=vs.108).aspx

Filip W
- 27,097
- 6
- 95
- 82