繁体   English   中英

在 asp.net Mvc 中加密 Url 参数

[英]Encrypt Url Parameter In asp.net Mvc

@using(Html.BeginForm("Action", "Controller", FormMethod.Get)
{          
  @Html.TextBoxFor(model=>model.Id)
  <input type="submit" value="Search" />
}

1-当我们点击提交按钮时,这将创建这样的网址

    http://localhost:53734/Controller/Action?id=10  
    //10 is input From Textbox

我想加密 Id 参数,如http://localhost:53734/Controller/Action?id=encrypted Value Of 10

据我了解,您想“隐藏”和“保护”请求。 最好的解决办法是:

  • 使用 HTTPS,以便传输提供加密
  • GET 和 POST 中的所有参数都是加密的(更多HTTPS URLs 是否加密? )。

如果不可能,请使用 RSACryptProvider 来加密参数。 通用加密代码在 MSDN: https : //docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.rsacryptoserviceprovider? view = netframework- 4.7.2

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM