Search code examples
urlpasswordsreset

Generate temporary URL to reset password


I am looking to implement a Forgot Password feature on my website. I like the option where an email containing a temporary one-time use URL that expires after some time is sent to the user.

I have looked at the following pages to get these ideas but I am not sure how to implement this using ASP.NET and C#. As one of the users indicated, if I can implement this without storing this information inside the database, that will be ideal. Please advise.

Password reset by emailing temporary passwords

Thanks.


Solution

  • Depending on your needs, you could encrypt information, in a format similar to the following format

    (UserId)-(ExpireDate)
    

    Encrypt the data, make that the link, then decrypt the data and take action from there...

    Crude, but most likely usable, and not requiring DB usage