【发布时间】:2013-09-12 14:32:48
【问题描述】:
我在添加 AntiForgeryToken 时遇到问题。这是我的代码:
<%:Html.ActionLink("Text", "Action", new { ID = "Hello")})%>
和
RedirectToAction("Action", "Controller", new { ID = "HelloFromMe"});
控制器:
[ValidateAntiForgeryToken]
public ActionResult Action(String ID){
return View();
}
有人知道怎么做吗?
【问题讨论】:
-
为什么要在 GET 方法中使用 AntiForgeryToken?
-
因为我传递的 ID 对应于 TempData 中的键。我希望请求包含验证令牌(甚至是获取请求)。
标签: c# html asp.net asp.net-mvc