如何在MVC中发送加密的URL链接 [英] How to send an encrypted url link in MVC

查看:476
本文介绍了如何在MVC中发送加密的URL链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将特定页面的URL链接(本地主机登录页面)发送到电子邮件地址(在文本框中键入).如果用户单击提交"按钮,则该URL链接需要以加密的格式发送受尊重的电子邮件ID.我已经作为普通链接完成了,但是需要发送加密的链接.
注意:我在mvc4中所需的全部内容

我尝试过的事情:

控制器

I need to send an particular page url link(local host login page) to an email address(typed in textbox).If user clicks the submit button the url link need to be send the respected email id ,in encrypted format.I already done as a normal link,but need to send an encrypted link.
Note: all i need in mvc4

What I have tried:

controller

public ActionResult Index(MailModel model)
      {
          using (MailMessage mm = new MailMessage("name@gmail.com", model.To))
          {
              string url = "http://localhost:49458/SendMailer/Login";
              string body = "Hello " + model.name + ",";
              body += "<br /><br />Please click the following link for Login Page";
              body += "<br /><a href = '"+url+ "'>Click here to go Login Page</a>";
              body += "<br /><br />Thanks";
              mm.Body = body;
              mm.IsBodyHtml = true;
              SmtpClient smtp = new SmtpClient();
              smtp.Host = "smtp.gmail.com";
              smtp.EnableSsl = true;
              NetworkCredential NetworkCred = new NetworkCredential("name@gmail.com", "pwd");
              smtp.UseDefaultCredentials = true;
              smtp.Credentials = NetworkCred;
              smtp.Port = 587;
              smtp.Send(mm);
          }
          return View();
      }


查看


view

<fieldset>
    <legend>
        Send Email
    </legend>
    @using (Html.BeginForm())
    {
        @Html.ValidationSummary()
      
        <p>To: </p>
        <p>@Html.TextBoxFor(m => m.To)</p>
        <p>name: </p>
        <p>@Html.TextBoxFor(m => m.name)</p>
        <p>From mail: </p>
        <p>@Html.TextBoxFor(m => m.Email)</p>

        <input type="submit" value="Send" />
    }  </fieldset>


型号


model

public class MailModel
{
    public string To { get; set; }
      public string Email { get; set; }
    public string name { get; set; }
}

推荐答案

嗨!如果我没记错的话,您在找这个吗?请点击此链接,让我知道.

在MVC 4中加密和解密URL – DotNetTrace.Net [ ^ ]
HI!! If I am not mistaken are you looking for this? Please follow this link and let me know.

Encrypt and Decrypt URL in MVC 4 – DotNetTrace.Net[^]


我在线找到了一篇帖子.你能经历一下吗?让我知道

Rusty Divine |如何在asp.Net MVC中加密密码重置电子邮件链接 [
I have found one post online. Can you please go through it ? Let me know

Rusty Divine | How to encrypt a password reset email link in asp.Net MVC[^]


这篇关于如何在MVC中发送加密的URL链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆