如何解决加密@Html.ActionLink 中的参数
我正在尝试从 asp.net
razor
在我看来,我有以下@Html.ActionLink
:
@Html.ActionLink(" ","index","Home",new { id = Server.UrlEncode(item.ID.ToString()) },new { @class = "fas fa-eye",@title = "Ver Detalle" })
我得到的链接如下:
http://localhost:62201/Home/index/1
这个想法是为了“更安全”隐藏或加密 id,就像这样:
http://localhost:62201/Home/index/unrecognizable_id
然后在我的 controller
我提前感谢您的帮助。
解决方法
如果你想隐藏Id,你可以尝试使用form post:
@using (Html.BeginForm("index","Home",FormMethod.Post))
{
<input hidden name="Id" value=@item.ID />
<input type="submit" value="submit" />
}
另外,如果要使用加密,可以参考link。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。