Updated on Kisan Patel
To perform Identity Authorization we need to add identity authentication in our project.
Now you can add authentication for whole controller and on particular method. we can authorize users based on username and password and Role defined in database.
If authorize attribute is applied for method then this method will not be available to the anonymous user.
[Authorize] // authentication for all users any user can use this action method public ActionResult Index() { return View(); } [Authorize(Role="Admin")] // Only Admin can use this action method no other role can user this action method public ActionResult Index() { return View(); } [Authorize(Role="Admin,Client")] // we can all roles by separating coma public ActionResult Index() { return View(); }