Secure email link sending, which allows the user to access an Action Edit in the controller

Asked

Viewed 37 times

0

I need to email a secure link so that the user at the click can access an Edit action in the controller. For example:

Sending the link: localhost:64148/Movies/Edit? id=4

However I cannot send the link this way, because when the user accesses it, will not be allowed due to the use of [ValidateAntiForgeryToken]

How do I send a secure link in this case? How do I deal with the token?

1 answer

0

Well, first of all it really would not be very safe to send the link this way, I would suggest creating a new action, whose parameter would be an encrypted token where, inside this token you would send some information like a security key, in addition to the user id. So when the user clicks on this link, this action would receive this token and decrypt it to get this data and confirm if it is a valid link.

Regardless of the part I explained to you about the encryption, I found this tutorial from Microsoft which shows how to create a user record with e-mail confirmation, that is, basically it is the same principle that you want to use, including they use the [ValidateAntiForgeryToken].

I hope it has helped. Any doubt I am available.

Hug!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.