Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to manage users in ASP.NET MVC

I'm new in ASP.NET MVC. I've switched to it from PHP.

In PHP, when i was creating a page that manage users, i often created the tables Users and Profiles and store the data in them. In ASP.NET, there are the Membership and Profile Providers.

So, my question is, what is the best way to manage users in ASP.NET MVC? Should I create custom tables and logic like in PHP or should I create Custom Providers?

I know, there are many similiar topics about this problem. However, none of them is exactly what I need.

Thanks in advance, Mike.

like image 443
michy04 Avatar asked Mar 23 '12 19:03

michy04


2 Answers

use ASP.Net Memebership do not recreate the wheel,

http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-7

like image 89
Oscar Cabrero Avatar answered Nov 14 '22 22:11

Oscar Cabrero


Probably should say there is no best way. Best is ambiguous.

I'd say there are three general types of ways to do users and roles with a SQL server (I mention this because you mentioned tables).

First: Use the built-in ASP.NET (webforms/mvc agnostic) SqlMembership Provider. It contains most of the features people need to manage users. This is most likely to be the fastest to implement, but the least extensible. This would be highly recommended.

Second: Build your own [Membership Provider], to follow the Membership provider pattern but introduce your own logic from the SQL to the Application. Building your own provide can be quite a lengthy process, but you still get all the nice features, and can be used in other projects because it is it's own provider and not tied to the application.

Third: Build your own logic from complete scratch. I would not recommend this unless you plan to build it like an independent application.

like image 27
Erik Philips Avatar answered Nov 14 '22 20:11

Erik Philips