C# How can I mark a URL invalid/obsolete?

104 Views Asked by At

I have a URL something like below. The URL gets generated each time, basically links are ephemeral. I want to mark this link as obsolete/invalid once it has been accessed in a browser. The second time when we access this URL, it should say invalid link. URL format is having an auth token. How can we do this in C#?

http://example.com/ui/landing?authToken=wwlC7bjUugIT5lo8uuX8d2wQhS__k6l80fSwPKzFuJWwDANgGVQtNT6C3q1lGcNk1p_ApBdurzPTayOzaGb6YibAdTKfzBdhKCcTNZwO54mg1KU_lPD6Zmg

Link must be marked as invalid once used.

1

There are 1 best solutions below

0
rwpk9 On

I don't think this can be done just by code.

I think a workaround would be to store the links on your server (database, file or watever). When someone uses the link you can check on that db if the link has been used and mark it as "used" if not.

Something like:

id Link (string) Used (boolean)
1 https://stack... 1
2 https://stack... 1
3 https://stack... 0