简体   繁体   中英

how to set expiry a hyperlink after one click in asp.net

we are sending a hyper link in the email to the users. if the user clicks that hyper link one time only. if he clicks that hyper link for the second time it should expire.

Thanks in advance

You need to have a unique identifier in each link and store the identifiers on the server side, usually in a database. Then in each request you need to:

  • check whether the identifier was already used
  • if it was, render "link expired" or do whatever you want
  • if it's first time you see this indentifier in request, mark it in your db and return desired response

It is wise to use GUIDs or add some additional parameter with hash to prevent users from guessing other identifiers (depends also on your use case).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM