Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom Membership and Role provider in ASP.NET MVC 4

I am creating an ASP.NET MVC 4 web application. I googled about custom membership, but I couldn't find good resources or video lectures.

Most of them are either outdated or dead links. Please could you suggest some resources about how to start writing a membership and role provider.

like image 658
Mukesh Sharma Avatar asked Feb 14 '13 10:02

Mukesh Sharma


2 Answers

Understanding about membership and roles was pretty difficult for me too, as you said there are not many reliable and detailed content you will find on web. I tried watching several videos to Understand about this topic but wasn't clear. But then two articles from a website called Code Project came for the rescue. I am sharing these Link where you can see a step by step guide about customize membership

Link 1
The link 1 will help you to replace an email with username for login authentication this is one of the most common customization the developers need in the microsoft provided Identity Module.

Link2

The second article will help you understand adding and attaching roles to the created user and how to limit the access of user registration page to an Admin only. This way with the help of these two articles I hope that you will Understand the Basics of Authentication and Authorization.

like image 131
Abdul Hannan Avatar answered Oct 30 '22 19:10

Abdul Hannan


I suggest using ASP.Net Identity instead of old membership.ASP.Net Identity is a way better and more flexible than old membership, it also supports role-based authentication using action filters and you can implement your own customized providers (such as role and user providers).

see links below

https://weblog.west-wind.com/posts/2015/Apr/29/Adding-minimal-OWIN-Identity-Authentication-to-an-Existing-ASPNET-MVC-Application

http://www.c-sharpcorner.com/article/create-identity-in-simple-ways-using-asp-net-mvc-5/

like image 28
Code_Worm Avatar answered Oct 30 '22 19:10

Code_Worm