Nothing
Nothing

Reputation: 2642

Implement Forget password in asp.net MVC C#

Could anyone show me some code about the forget password sample? I have no idea about that. For my login and remember me, I used Membership provider of asp.net MVC.

Upvotes: 0

Views: 5187

Answers (2)

STO
STO

Reputation: 10638

Regardless to membership provider, here is a small example of change password:

  • Create action that requests user's email
  • Generate new password but not change it in database
  • Generate encrypted token that contains about user id and generated password
  • Create action that accepts token, decrypt it and reset password for user
  • Make url to action that accepts token as parameter, resets password and redirects to login page
  • Generate email message with url to action that resets password

Upvotes: 9

Matt Griffiths
Matt Griffiths

Reputation: 1142

Forgotten Password functionality is usually a business decision, there are multiple ways to implement it.

For example, the ASP.NET Membership Provider offers a secret question / answer policy, and you can reset the password if it validates; or you could also just have the system reset the password itself, and email the password to the user anyway.

This is a good post that seems to cover most of the issues for the former approach, and is implemented in ASP.NET MVC.

Thanks,

Matt

Upvotes: 4

Related Questions