How to reset user's password without having to use PasswordRecovery

H

Homer

Hi,

I want to be able to reset a user's password and I do not want to use
the PasswordRecovery control to reset and email it to the user. A
while back, I thought I'd read an article that mentioned about
resetting password using the Website Administration Tool. I could not
find such option in WSAT. Please help!

Thanks,
Jon
 
M

Mark Fitzpatrick

The MembershipUser object has a ChangePassword method. It also has a
ResetPassword method, but the ResetPassword will generate one randomly. What
you can do though is obtain an instance of the user via their username

MembershipUser user = System.Web.Security.Membership.GetUser(username);


To change the password you need to know the old password, though if you call
resetpassword it will return the newly reset password string so you can do:

user.ChangePassword(user.ResetPassword(),"mynewpassword);

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
H

Homer

The MembershipUser object has a ChangePassword method. It also has a
ResetPassword method, but the ResetPassword will generate one randomly. What
you can do though is obtain an instance of the user via their username

MembershipUser user = System.Web.Security.Membership.GetUser(username);

To change the password you need to know the old password, though if you call
resetpassword it will return the newly reset password string so you can do:

user.ChangePassword(user.ResetPassword(),"mynewpassword);

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage








- Show quoted text -

Thank you Mark. I'll implement your suggestion now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top