The required anti-forgery form field “__RequestVerificationToken” is not present Error in user Registration

后端 未结 19 1214
旧巷少年郎
旧巷少年郎 2020-11-29 22:12

I am using Membership.create user function, then the following error is occurring,

The required anti-forgery form field \"__RequestVerifi

相关标签:
19条回答
  • 2020-11-29 22:41

    Like this:

    The Controller

    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult MethodName(FormCollection formCollection)
    {
         ...
         Code Block
         ...
    }
    

    The View:

    @using(Html.BeginForm())
    {
         @Html.AntiForgeryToken()
         <input name="..." type="text" />
         // rest
    }
    
    0 讨论(0)
提交回复
热议问题