Skip to main content

Posts

Showing posts from May, 2017

Custom Authentication and Authorization in MVC 5

There are certain scenario's in our projects we which needs to used for custom Authentication instead of using Default MVC5 Asp.net Identity mechanism. So here I am explaining on how to create custom authentication and mapping it to the default filters like Authorize, roles..etc. 1.Open visual studio create a new project 2. Select ASP.NET Application and name the project 3. Select MVC template 4. After loading the project , create a new folder DAL (Here we can call our custom implementation methods for User Authentication) 5. Now project structure looks like the below diagram in solution explorer 6. Add two classes in DAL layer, User.cs and Repository.cs  7. Paste the below code in User.cs file public class User { public string Email { get ; set ; } public string Roles { get ; set ; } public