How to programatically activate the ASP.net "Password Recovery" ?

Discussion in 'ASP .Net Security' started by Ofer, Oct 9, 2006.

  1. Ofer

    Ofer Guest

    Hi,

    We use the ASP.net loginControls and the DB schema.
    How to programmatically activate the "PasswordRecovery" of a specific
    end-user when a user clicks my web application's button?
    I need to send a specific user an email with a new "reset" password.

    I thought of including an invisible PasswordRecovery Control and initialize
    the "User Name" field.
    PasswordRecovery1.UserName = "zako";
    PasswordRecovery1.Visible = false;
    But how to simulate a "click" of the PasswordRecovery control's "Submit"
    button?

    Thanks!
     
    Ofer, Oct 9, 2006
    #1
    1. Advertising

  2. Ofer

    offwhite Guest

    I created some free ASP.NET controls you may find useful.

    http://brennan.offwhite.net/blog/2006/09/15/free-controls-for-user-and-roles-management/

    They are simply User Controls which use the Membership Provider. These
    controls do not have a button to reset the password for a user, but you
    can do that with this code.

    Private Sub ResetPassword(ByVal username As String)
    Dim user As MembershipUser = Membership.GetUser(username)
    Dim oldPassword As String = user.GetPassword()
    Dim newPassword As String = Membership.GeneratePassword(8, 2)
    user.ChangePassword(oldPassword, newPassword)
    ' send new password to user.Email
    End Sub

    It generates a new password for the user. Once done, you can send that
    user an email with the new password.

    Brennan Stehling
    http://brennan.offwhite.net/blog/

    Ofer wrote:
    > Hi,
    >
    > We use the ASP.net loginControls and the DB schema.
    > How to programmatically activate the "PasswordRecovery" of a specific
    > end-user when a user clicks my web application's button?
    > I need to send a specific user an email with a new "reset" password.
    >
    > I thought of including an invisible PasswordRecovery Control and initialize
    > the "User Name" field.
    > PasswordRecovery1.UserName = "zako";
    > PasswordRecovery1.Visible = false;
    > But how to simulate a "click" of the PasswordRecovery control's "Submit"
    > button?
    >
    > Thanks!
     
    offwhite, Oct 9, 2006
    #2
    1. Advertising

  3. Ofer

    Ofer Guest

    Re: How to programatically activate the ASP.net "Password Recovery

    Hi,

    Thanks a lot for your reply.

    However it will only help after I solve this one -
    How can my server app reset a password programaticaly in a different
    membership provider than the one my server app is using?

    Thanks!

    "offwhite" wrote:

    > I created some free ASP.NET controls you may find useful.
    >
    > http://brennan.offwhite.net/blog/2006/09/15/free-controls-for-user-and-roles-management/
    >
    > They are simply User Controls which use the Membership Provider. These
    > controls do not have a button to reset the password for a user, but you
    > can do that with this code.
    >
    > Private Sub ResetPassword(ByVal username As String)
    > Dim user As MembershipUser = Membership.GetUser(username)
    > Dim oldPassword As String = user.GetPassword()
    > Dim newPassword As String = Membership.GeneratePassword(8, 2)
    > user.ChangePassword(oldPassword, newPassword)
    > ' send new password to user.Email
    > End Sub
    >
    > It generates a new password for the user. Once done, you can send that
    > user an email with the new password.
    >
    > Brennan Stehling
    > http://brennan.offwhite.net/blog/
    >
    > Ofer wrote:
    > > Hi,
    > >
    > > We use the ASP.net loginControls and the DB schema.
    > > How to programmatically activate the "PasswordRecovery" of a specific
    > > end-user when a user clicks my web application's button?
    > > I need to send a specific user an email with a new "reset" password.
    > >
    > > I thought of including an invisible PasswordRecovery Control and initialize
    > > the "User Name" field.
    > > PasswordRecovery1.UserName = "zako";
    > > PasswordRecovery1.Visible = false;
    > > But how to simulate a "click" of the PasswordRecovery control's "Submit"
    > > button?
    > >
    > > Thanks!

    >
    >
     
    Ofer, Oct 22, 2006
    #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. Rick Gamble

    Password Recovery Email Encrypted

    Rick Gamble, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    613
    Will Asrari
    May 9, 2006
  2. John

    Password recovery

    John, Feb 20, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    497
  3. jobs
    Replies:
    0
    Views:
    850
  4. jobs
    Replies:
    0
    Views:
    257
  5. Junkone
    Replies:
    2
    Views:
    223
    Jarmo Pertman
    Oct 27, 2010
Loading...

Share This Page