How to change a hashed password using asp.net membership provider if you don’t know the current password

asp.netmembership-provider

Problem, there's no method:

bool ChangePassword(string newPassword);

You have to know the current password (which is probably hashed and forgotten).

Best Solution

This is an easy one that I wasted too much time on. Hopefully this post saves someone else the pain of slapping their forehead as hard as I did.

Solution, reset the password randomly and pass that into the change method.

MembershipUser u = Membership.GetUser();
u.ChangePassword(u.ResetPassword(), "myAwesomePassword");