How Authorization Filter in ASP.NET MVC works ?
Authorization filter implements “IAuthorizationFilter” interface .
Authorization filter runs before any other filter and responsible, to authorize a user request. ASP.Net MVC provides [ AuthorizeAttribute ] class to authorize a request.
Code as Follow :
[Authorize]
public ActionResult AdminDashBoard()
{
// Place Your Code
return View();
}
In this way you can make your CustomAuthorize filter attribute either by implementing IAuthorizationFilter interface or by inheriting and overriding above methods of AuthorizeAttribute class.
Authorization Filter ASP.NET MVC , Razor , MVC , AngularJS , ASP.NET , C# , What is ASP.NET MVC ?