Skip to main content

Posts

Showing posts with the label asp.net mvc authorization roles

ASP.NET C# 6.0 Features that every ASP.NET Developer should know about it!

  ASP.NET C# 6.0 Features that every ASP.NET Developer should know about it.         1. Auto-property  initializes         public int ID { get ; set ; }         public bool Role { get ; set ; } = true ;         public string Name { get ; set ; } = string .Empty;         public DateTime CreatedDate { get ; set ; } = DateTime .Now;        2. Expression bodied members                     public string Name => string .Format( "{0} {1}" , FirstName, LastName);         3. Getter-only auto-properties                     public DateTime Bi...

Custom Roles Base Authorization in ASP.NET MVC

Hello everyone, I am going to share the code sample to roles base authorization  and authentication in ASP.Net MVC 5 using FilterAttribute  and AspNetUserRoles . The Steps detail as given below. ASP.NET Forms Authentication namespace Authorize.Controllers {     [Authorize]     public class AccountController : Controller     {         [HttpPost]         [AllowAnonymous]         public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)         {             if (ModelState.IsValid)             {                      int t...