Problem, there's no method:
bool ChangePassword(string newPassword);
You have to know the current password (which is probably hashed and forgotten).
From stackoverflow
-
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");DOK : Hey, come on. Don't downvote for answering your own question. The FAQ encourages that. See http://stackoverflow.com/questions/18557/how-does-stackoverflow-work-the-unofficial-faq#119658harriyott : The down-vote (not me!) was before the answer was moved here. Previously it said that the answer was in the question. I'm not too keen on down-voting people who have only just joined SO - it's much better to edit to help out.CheGueVerra : Yes and he gets the pretty badge too !!chakrit : @harriyott doh... I think next time one of us should leave a comment indicating we're editing... so we don't waste time doing the same thing.Andi : On my app i get this: Value cannot be null. Parameter name: passwordAnswer any ideas??Andi : Make sure you have this attribute set in your web.config if you get the error above: requiresQuestionAndAnswer="true"Frank Schwieterman : I wasted a lot of time before I found this answer, thank you.
0 comments:
Post a Comment