Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i have a login function but i have a link button which link to Forget.aspx....
where it have a textbox for user to enter their email

however, normally, if user forget the password, then the user will come to this Forget.aspx
but the website should not be able to retrieve the password because of the password is hash during register and store in table password

so what i think was may be after the user enter the email address, it will email me a reset link
then if i go to the email, i should have receive the link, once i click on it should prompt me to my website where it has a 2 textbox; reset new password and confirm reset new password


However i not sure how to do this? hopefully someone can show me an example or sample of how this can be done?
Posted

1 solution

If you hash your users password (Yay! Well done!) then no, you can't retrieve it if they forget it.
The normal way to handle this is to reset the password to a random string (I use a Guid, but you can use the GeneratePassword method[^]) and then email the new password to the users registered email address. Remember to provide them with a facility to change the password, as all random passwords are difficult to remember and thus tend to get written down and stuck to the computer... A simple page which just says "Password reset - the new one has been emailed to your registered email address" is all you need once you have got the userid or email address that they have forgotten the password for.

The email part is pretty simple, there is a generic routine here that should help: Sending an Email in C# with or without attachments: generic routine.[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900