0

I'm using the ChangePassword method of membership provider to change the password and one of the requirement before calling the ChangePassword is to retrieve the current password. But I'm getting error: padding is invalid and cannot be removed

below is my web.config:

<system.web>
    < machineKey validationKey="4FD671E39167DFB91A918018007D095E50B7D2971B01AEDE26A7233FD9CC4A470F80689997EC2C7BB515F9D82C8B4D1F3A8495193630B11E8401C96BD0A5A133"
                decryptionKey="ED1555E75C7B91738172E0086456C70B9CAA4C44214FC2B1907123993EA4FA53"
                validation="SHA1"
                decryption="AES"/>
....
< /system.web>
1
  • So are you getting the error when calling ChangePassword or when retrieving? Commented Dec 10, 2010 at 1:19

1 Answer 1

3

You cheat, you reset the password to a known value first.

MembershipUser user = Membership.GetUser();
string generated = user.ResetPassword();
user.ChangePassword(generated, *newPassword*);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.