What is Action filters in Asp.net MVC and How Many Type of Action Filiters

What is Action filters in Asp.net MVC :

Action filters in Asp.net:

Action filters apply pre and post processing logic to an action method and can modify the result. Action filters are typically used to apply cross-cutting concerns, logic that you want to apply to multiple methods but don’t want to duplicate code across controllers. Caching, validation and authorisation are examples of the type of cross-cutting concerns that action filters can be used to implement.
Asp.net MVC

Action filters can be applied to individual methods or to the controller itself. When applied at the controller level the filter will apply to all action methods in that controller.

How Many Type of Action Filiters:

In ASP.NET MVC there are basically 4 different types of filter:
  • Authorization filters – Implements the IAuthorizationFilter attribute.
  • Action filters – Implements the IActionFilter attribute.
  • Result filters – Implements the IResultFilter attribute.
  • Exception filters – Implements the IExceptionFilter attribute.

Other Related Post:




Comments