Search code examples
asp.net-mvc-3asp.net-membershipasp.net-profiles

MVC3 Membership Profile Conversion from ASP.NET


I am converting a web application from asp.net to MVC3 and am trying to figure out how to set and access the profile properties that were configured in the old application.

I can access the database from the old app and I can create new users using MVC3 using

Membership.CreateUser(model.UserName, model.Password, model.Email, model.SecretQuestion, model.SecretAnswer, true, out createStatus);

This new user is placed in the database "USER" table. I need to also store additional information about the user and I must still user the old database that was created in the old application so when we switch over to the new app the current users can still logon and not notice a change other than some layout improvements.

The old database also has a table in it called "PROFILE" which stored the additional values like so

UserId , PropertyNames , PropertyValuesString , PropertyValuesBinary , LastUpdatedDate

DB7E1F8E-FB45-49E5-A2AF-C83A371CC22F , PartnerID:S:0:2:FirstName:S:2:4:LastName:S:6:12:Indexed:S:18:1: , 26MiloMinderbinder3 , 0x , 2010-09-29 21:23:33.737

This was created using the MembershipWizard which is not available in MVC3. I need to find a way to create users with MVC3 and still add the appropriate values to this table.

Thank you in advance for any help you can provide.


Solution

  • You can make your own Membership class... Try implementing the MembershipProvider class and register it in your Web.Config...

    It's very flexible way to handle Membership. I use it all the time...