Sunday, 25 November 2018

The required anti-forgery form field "RequestVerificationToken" is not present Solution


應用程式中發生伺服器錯誤。 

The required anti-forgery form field "__RequestVerificationToken" is not present.

解決方式:

在View 送出的Form頁面using處下方,要加入下面字眼

@Html.AntiForgeryToken()

(Solutions)
You have [ValidateAntiForgeryToken] attribute before your action. 
You should add @Html.AntiForgeryToken() in your form.

Example:
@using(Html.BeginForm())
{
     @Html.AntiForgeryToken()
     <input name="..." type="text" /> 
}

No comments:

Post a Comment

IIS HTTP Error 403.18

 HTTP Error 403.18 - Forbidden The specified request cannot be processed in the application pool that is configured for this resource on the...