Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Membership Password Reset

This is crazy, I have been trying for hours to get this to work.

My client wants to be able to reset password for users who have forgotten them The only parameter he has is the UserName. He does NOT want the user to be able to reset the password themselves, no that would be too easy...ARGHHHHH!!

Anyway, if anyone has any suggestions how I could reset someones password or give them a new temp password somehow, that would be greatly appreciated.

like image 339
Steve Avatar asked Apr 10 '10 18:04

Steve


People also ask

How to reset password in ASP net membership?

MembershipUser usr = Membership. GetUser(username); string resetPwd = usr. ResetPassword(); usr. ChangePassword(resetPwd, newPassword);

How can I recover my ASP NET MVC password?

Password reset settings configured in Settings -> Security & Membership -> Passwords -> Password reset. The URL of the password reset page is determined by the route of the corresponding MVC action. The validity of password reset requests depends on your application's ASP.NET Identity configuration (1 day by default).


1 Answers

How about something like this?

MembershipUser mu = Membership.GetUser(username);
mu.ChangePassword(mu.ResetPassword(), password);

Here's a link that does this (with above code snippet) in conjunction with the Q&A feature on in the provider.

like image 99
Kevin LaBranche Avatar answered Sep 21 '22 08:09

Kevin LaBranche