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

Discussion in 'ASP .Net' started by Homer, Aug 7, 2007.

  1. Homer

    Homer Guest

    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
     
    Homer, Aug 7, 2007
    #1
    1. Advertising

  2. 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

    "Homer" <> wrote in message
    news:...
    > 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
    >
     
    Mark Fitzpatrick, Aug 8, 2007
    #2
    1. Advertising

  3. Homer

    Homer Guest

    On Aug 7, 4:20 pm, "Mark Fitzpatrick" <> wrote:
    > 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
    >
    > "Homer" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > 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- Hide quoted text -

    >
    > - Show quoted text -


    Thank you Mark. I'll implement your suggestion now.
     
    Homer, Aug 8, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?am1obWFpbmU=?=

    PasswordRecovery Control - Control Random Password Characters

    =?Utf-8?B?am1obWFpbmU=?=, Dec 31, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    830
    rodean
    Feb 15, 2008
  2. Ben
    Replies:
    3
    Views:
    343
  3. Ghistos
    Replies:
    4
    Views:
    443
    JackPot
    Jul 29, 2008
  4. AAaron123
    Replies:
    2
    Views:
    2,376
    AAaron123
    Jan 16, 2009
  5. AAaron123
    Replies:
    1
    Views:
    1,427
    Oriane
    Jan 16, 2009
Loading...

Share This Page