Is there a way to migrate asp.net membership users to an Orchard v1.3 db?

Topics: Administration, Customizing Orchard
Nov 28, 2011 at 3:34 PM

I have a legacy site that uses the classic asp.net membership database tables (aspnet_*). There are about 700 users in there that we need to migrate over to orchard. Does anybody know how to do this? I don't know the passwords, so I don't think manually entering them will work. Has anybody done this with success in the past?

Coordinator
Nov 28, 2011 at 9:47 PM

I don't know from the top of my head what the asp.net membership table looks like, but it has to have hashed passwords, and salt. Orchard has the same structure, so in theory this should be possible, without having to know the passwords.

Nov 28, 2011 at 10:05 PM

The aspnet_membership tables store the password hash and the salt. I don't know what it takes to decrepit these passwords. Does it take the has and the salt? What table does Orchard store the users?

Thanks!!!!

Coordinator
Nov 28, 2011 at 10:12 PM
Edited Nov 28, 2011 at 10:13 PM

You don't need to decrypt them (and actually you can't: a crypto hash is a one-way process). Just copy the hash and salt over. The Orchard table you need is Orchard_Users_UserPartRecord. But be careful, as users are content items, you should first create the users through IMembership.CreateUser and only then hack the hashes and salt into the records you just created.

Nov 28, 2011 at 10:28 PM

Ok, so the user needs to be there first. OK... I just tried importing a user with the password and salt, then tried loggin in as him...no good. I will try to delete the user, then create the use from the admin interface, then hack the pw and salt. Thank you so much for all your help!

Nov 29, 2011 at 5:42 AM

yep...Worked like a champ! Created the user first, then copied the pw and salt.