Is the .Net membership database portable or are the accounts somehow tied to the original website or server?
I have an ASP.Net website using .Net membership with a SQL Server provider, so users and roles are stored in SQL tables generated by Aspnet_regsql.exe.
Is this architecture completely self-contained and portable, or is the users in it somehow tied to a specific website where they create their account?
In other words, if we create a user group in dev or UAT, back up and restore that database to another server, accessed under a different domain name, should it work fine?
We are seeing some weird behavior when we move the database, like users lose group membership, etc., and I'm curious how portable and environmental agnostic this database really is. I have a suspicion that something has to do with the machine key or domain.
a source to share
Yes, they should work fine .
The only place you need to be careful is in password management. .Net Membership providers can use computer-specific keys to encrypt or hash passwords . But there is work in there where you tell the asp.net application to use a specific machine key rather than auto-generated specific machines.
In my application, I keep my passwords encrypted and I have defined my machine key as shown below for encryption / decryption. When I do, I can migrate my development database to the production server and also easily transfer the database from one production server to another.
<machineKey validationKey="<your-validation-key>" decryptionKey="<your-decryption-key>" validation="SHA1"/>
You no longer need to worry about migrations while working with MembershipProviders.
a source to share
Users are tied to the application name. You can check it and see if the application name for each user matches the application name in the web.config on your production server.
Also, when you transfer your membership to another database, you must make sure that you are using not only tables, but all stored procedures. If for any reason you are simply porting your database schema, you should run Aspnet_regsql.exe before porting it.
a source to share