ASP.NET MVC Filters
ASP.NET MVC provide filters to execute code logic before and after controller action execution. Pre-action and post-action behaviour are added to controller action method by filters. Custom filters creation depends on inheriting and overriding methods of ASP.NET MVC filter attribute class or by implementing filter interface.
Various type of filters :-
- Authorization filters :- This filter implements IAuthorizationFilter interface and when used with controller action makes security decision to execute action method if user is an authorized user else action method will not be executed.
- Action filters :- This filter implements IActionFilter interface. OnActionExecuting and OnActionExecuted are two methods provided by IActionFilter. OnActionExecuting is executed before action method while OnActionExecuted is executed after action method.
Read more about ASP.NET MVC Filters visit FindNerd.