-> Filters are custom classes that provide both a declarative and programmatic means to aid pre-action and post-action behavior to controller action methods.

Authorization Filters
-> These implement IAuthorizationFilter and make security decisions about whether to execute an action method, such as performing authentication or validating properties of the request.
-> Authorization filters run before any other filter.
-> AuthorizeAttribute, RequireHttpsAttribute

Action Filters
-> Action filters are attributes that can be applied either on a controller action method or on a controller. When applied at the controller level, they are applicable for all actions within that controller.
-> Action filters allow us to add, pre and post processing logic to an action method. They allow us to modify the way in which an action is executed.

Result Filters
-> These implement IResultFilter and wrap execution of the ActionResult object.
-> OutputCacheAttribute

Exception Filters
-> These implement IException filter and execute if there is an unhandled exception thrown during the execution of ASP.NET MVC pipline.—> e g; HandleErrorAttribute

Filters provided in ASP.NET MVC
-> Restricts access by authentication and optionally authorization.
-> Specifies how to handle an exception that is thrown by an action method.
->This filter does not catch exceptions unless the customErrors element is enabled in the Web.config file.
-> Provides output caching.
-> Forces unsecured HTTP requests

Leave a Reply

Your email address will not be published. Required fields are marked *