ASP.NET MVC: Authentication and Authorization
By FoxLearn 5/29/2017 8:55:45 PM 4.67K
How to Implement Authentication and Authorization, check if user is authorized inside action with ASP.NET Identity MVC 5 using C#, Entity Framework Code First
Step 1: To check user authentication and authorization you can change the HomeController as below
public class HomeController : Controller { public ActionResult Index() { return View(); } [Authorize(Roles = "Admin")]//user 1 public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } [Authorize(Roles = "Sales")]//user 2 public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } }
VIDEO TUTORIALS
- ASP.NET MVC: Free Responsive Templates
- ASP.NET MVC: Implement Password Reset with ASP NET Identity
- ASP.NET MVC: Getting Started
- ASP.NET MVC: Create Custom Routes
- ASP.NET MVC: Create Login Form
- ASP.NET MVC: Login with Google Account
- ASP.NET MVC: Custom properties for IdentityUser
- ASP.NET MVC: Performance Optimization with Bundling and Minification
Categories
Popular Posts
Visual Studio: Auto increment version
03/22/2024
What is ARM architecture?
03/11/2024