views:

615

answers:

5

Are there any alternatives\mods to .net Membership?

I find it quite restrictive;

  • Cant change Username, easily. You have to create a new user and copy the fields, but then you lose the primary key OR you have to edit the user table directly yourself.

  • Additional profile fields are stored together as one blob.

+7  A: 

ASP.Net membership uses a provider model. That means you are completely free to implement your own membership provider, or even inherit from and extend an existing provider, as long as you follow the provider contract.

Plus one for asking about existing alternatives rather than trying to build something new yourself, though.

Joel Coehoorn
A: 

As far as changing the username goes, that can easily be accomplished by using the CreateNewUser() method and filling in the appropriate fields based on the current User, and then deleting the current user.

Profile fields are not part of the .NET Membership Provider model, but part of the Profile Provider. This is a highly debated topic and for most production machines, the correct way to go is to drop-in a better profile provider solution, such as this Table Profile Provider, which stores profile fields as you'd expect rather than as a memory-hogging blob. Alternatively, you can easily roll your own profile provider, check out the instructions here.

There are certainly .NET Membership alternatives, but most are buggy or have a small featureset. It really sucks to develop on top of one for two months and then realize it won't support all the functionality you need. .NET Membership is a proven solution and that's why it is used so often.

JoshJordan
If you create new user it will also generate new ID for it, right? Not good if user is already referenced by other tables.
XOR
No, but pretty simple to fix in your method for "changing" the username.
JoshJordan
A: 

As for the Profile there are a couple of alternatives out there. These two use either a table or let you call a stored procedure. Of course you can also implement your own. I personally got tired of using the Profile Providers, and found that dealing with the profile in my code was easier to control and contain.

As for the other issues, you can also implement your own provider. Microsoft released the source code to the SQL Providers so it can give you a starting point.

JoshBerke
+2  A: 

As the ASP.NET membership model is built around Providers, there are a number of alternatives available.

By default, users have a ProviderUserKey, which is a GUID, and that's the Primary key of the database, so you should be able to write something to change their username if you want.

In terms of the profile, yes, the default blob is fairly annoying. You could take a look at the SQL Table Profile Provider which maps profiles on to tables, or fairly quickly roll your own.

Zhaph - Ben Duguid
@Dan - By UserID, I was refering to the PKs in the database tables aspnet_Membership and aspnet_users, which are indeed called UserId
Zhaph - Ben Duguid
A: 

If you're looking for an alternative, I encourage you to take a look at MemberProtect.NET. You'll find that the two issues you stated in your original question are designed more to your liking in MP. While designed for banking web applications, the framework works equally well for any membership website with a focus on personalization and security.

The installer will get you up and running quickly and provide you with a complete user, organization and role management web application (Visual Studio solution in C#) to quickly get started learning and using the MemberProtect framework.

You can download a free Lite version at http://www.memberprotect.net

Jason InetSolution, Inc.

Disclaimer: I work at InetSolution on the MemberProtect team.

Jason Sherrill