I have a SendEmail method which generates a link through HTTP request, which will send to the user's email for exchange. However for tests I fixed the user ID in this URL, but for security reasons I have to encrypt it. How do I do this?
Follow the code
Confirm Shipping Method
public IActionResult ConfirmarEnvio(Clientes objLogin)
{
try
{
var link = HttpContext.Request.Host.Value;
Email objEmail = new Email(_config);
objEmail.CliCodigo = objLogin.CliCodigo;
objEmail.CliEmail = objLogin.CliEmail;
objEmail.link = link;
objEmail.EnviarEmail();
return View("Login");
}
catch (Exception ex)
{
throw ex;
}
}
Part of the method that generates the link:
//From Address
string FromAddress = _config.GetValue<string>("From");
string FromAdressTitle = "TesteEnvio";
//To Address
string ToAddress = CliEmail;
string ToAdressTitle = "Microsoft ASP.NET Core";
string Subject = "Redefinição de senha";//Assunto,
StringBuilder BodyContent = new StringBuilder();
BodyContent.Append ("Prezado(a) para redefinir sua senha, por favor clique no link abaixo.");
BodyContent.Append ("<br/>");
BodyContent.Append ("Link: http://" + link + "/Accounts/RedefinicaoSenha?id=" + CliCodigo +"");