Some time we want to perform logic either before as action method is called or after an action method runs.
To support this, ASP.NET MVC provides filters
1. Action Filters
2. Types of Filters
The ASP.NET MVC framework supports four different types of filters −
To support this, ASP.NET MVC provides filters
1. Action Filters
- OutputCache − Caches the output of a controller action for a specified amount of time.
- HandleError − Handles errors raised when a controller action is executed.
- Authorize − Enables you to restrict access to a particular user or role.
2. Types of Filters
The ASP.NET MVC framework supports four different types of filters −
- Authorization Filters − Implements the IAuthorizationFilter attribute.
- Action Filters − Implements the IActionFilter attribute.
- Result Filters − Implements the IResultFilter attribute.
- Exception Filters − Implements the IExceptionFilter attribute.
No comments:
Post a Comment