I have an asp.net application, using aspnetsqlMembership provider for encrypt/descrypt user profile data. Now, we decided to move our application to a new server, but I am getting this error on the new server when I am trying to create a new user (encrypting):
Key not valid for use in specified state
What I already tried: 1. I Imported the certificate from the old server and it seems to be good/ 2. I Checked the security permissions of the certificate, and they are the same as those on the old server 3. Also the machine key definitions on the IIs seems to be the same. 4. Tried to change sqlmembership format from encrypted to hashed, but the exception still throwed.
I spent al lot of time on trying to solve this problem. Will be happy if anybody here can help me. Thanks, Hana.
The encryption of the passwords for the SqlMEmbershipProvider has nothing to do with a certificate.
Microsoft Docs: SqlMembershipProvider.PasswordFormat Property
Have a look at your web.config file. Is there a section? Are there any values in there?
Make sure the new server has exactly the save values!
If there is no section or no values...
You must have access to the old server once again!
@Mr-Curious has written a nice answer on how to resolve the values (keys) for the machineKey section if they are not existent (
AutoGenerated).