gpt4 book ai didi

asp.net-mvc - Html.AntiForgeryToken Helper 不在表单中呈现请求验证 token 隐藏字段

转载 作者:行者123 更新时间:2023-12-01 12:48:59 25 4
gpt4 key购买 nike

razor View 中的以下代码不会创建隐藏输入类型的 HTML,名称“__RequestVerificationToken”很奇怪。我有用属性“ValidateAntiForgeryToken”修饰的“注销”操作。

@using (Html.BeginForm("LogOff", "Account", FormMethod.Post))
{
Html.AntiForgeryToken();
<input type="submit" value="LogOff" />
}

我在这里缺少什么?

最佳答案

应该是

@Html.AntiForgeryToken()

不是

Html.AntiForgeryToken();

关于asp.net-mvc - Html.AntiForgeryToken Helper 不在表单中呈现请求验证 token 隐藏字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27014559/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com