简体   繁体   中英

trying to encrypt & decrypt password in asp.net mvc

Hi want to encrypt the password before sending it in httpost method. in my view section i am capturing password and sending in controller section at httppost i want to encrypt password before sending it in httppost method and at Post section i want to decrypt the password before sending it to a service for authentication. View

 @using (Html.BeginForm("Login", "Home", FormMethod.Post))
 {
  <div class="col-md-8 col-md-offset-2">
  @Html.Password("txtBxPassword", null, new { @class = "form-control" })
  </div>
}

Controller

[HttpPost]
public ActionResult Login(FormCollection form)
{
string msg= oService.GenericIsAuthenticatedWithMessage("ABC", form["txtBxUsername"].ToString().Trim().ToUpper(), form["txtBxPassword"].ToString());
}

在发布之前通过转换为 base64 加密您的密码并在服务器端从 base64 解密为字符串

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