views:

1161

answers:

3

For some reason, the idea of setting up Membership in ASP.NET MVC seems really confusing.

Can anyone provide some clear steps to setup the requisite tables, controllers, classes, etc needed to have a working Membership provider?

I know that the Demo that MVC ships with has an Accounts controller. However, should I be using this in my own project? What do I need to get my existing database ready if so? If not, how do I learn what I need to do to implement a membership provider?

+2  A: 

Check out this step by step blog on how to set up Membership provider in your asp.net mvc project. The sdk tool you need to get your database ready is aspnet_regsql.exe, you don't need to create a separate database to do that ( a lot of people think they have to provide a separate aspnet.db), you can run the command on your existing database, and it will create the tables, views, and stored procedures to handle the membership provider for you.

However, should I be using this in my own project? What do I need to get my existing database ready if so? If not, how do I learn what I need to do to implement a membership provider?

The benefit to use the default provider (SqlMembership provider) is to save yourself a lot of time. It involves a lot of work to design a complete membership and role provider.

J.W.
I agree totally. The provided SqlMembership is so easy to implement and covers the majority of the cases necessary for a login system.
Nick DeVore
So, if I follow what is used above, will I also use the "Account" controller that comes with the MVC template?
Yes, why not if it's given to you free. Never reinvent the wheel except you are sure you can make the wheel better.
J.W.
A: 

check out my answer in this post;

membership

If you want to keep the membership provider that .Net creates for you then you can copy all the tables etc to another sql database and point the provider at it via the config file.

Post a comment if you need more than this.

griegs
A: 

Hey y'all i'm looking for the easiest way to use MVC 2 Account control with my own database (i have my own tables of users and roles)... i'm not really familiar with the whole membership API where should i define the user validation/authentication/authorization against my own DB ? thanks ahead guys! Dan

danfromisrael
hey guys, after a long search on the web i've found the answer.here's my post on another thread with the answer: http://stackoverflow.com/questions/2771094/asp-net-mvc2-custom-membership/2780406#2780406
danfromisrael
hey danfromisrael, could you please check my comment on your post on the link you posted here
ile

related questions