ASP.NET MVC Filter Based Authorization
We may use action filters for authorization in an ASP.NET MVC application. An action filter is an attribute that we can apply to a controller action or an entire controller. The ASP.NET MVC framework includes several action filters including OutputCache, HandleError, and Authorize. Authorize action filter enables us to restrict access to a particular user or role. Authorization filters implements the IAuthorizationFilter attribute. Authorization filters are used to implement authentication and authorization for controller actions. The ASP.NET MVC framework includes a base ActionFilterAttribute class. This class implements both the IActionFilter and IResultFilter interfaces and inherits from the Filter class. The base ActionFilterAttribute class has the following methods that to override: OnActionExecuting – called before a controller action is executed. OnActionExecuted – called after a controller action is executed. OnResultExecuting – called before a cont...