Question : asp.net membership - forgot password email instead of username

Hi

I'm using the asp.net membership, however, if you forgot the password, it asks you for your username
i usually forget that too, so ideally i need to have it ask for the email address and send a password/password reset link to the email address instead of asking for a username

how would this be done?
is there any code examples someone can give me please
thanks

Answer : asp.net membership - forgot password email instead of username

You can retrieve username by email like:
string username = Membership.GetUserNameByEmail(useremail)

You can use this now in PasswordRecovery.

Or using your own interface i.e. a Textbox and button do something like this:

protected void Button1_Click(object sender, EventArgs e)
{
    string username = Membership.GetUserNameByEmail(txtEmail.Text);
    MembershipUser mUser = Membership.GetUser(username);
    string newpassword = mUser.ResetPassword();
    //Send email using system.net.mail classes
}
Random Solutions  
 
programming4us programming4us