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

聯邦數位帳戶NewNewBank推薦碼,15%高利息優惠

 好推分享!New New Bank數位帳戶【推薦開戶】台幣高利活儲、投資下單手續費優惠等超多好康,立即開戶: https://newnewbank.ubot.com.tw/web/#/S0101001?pm=3&ID=ZZIDIHI 透過上面連結開戶,你會享有一個月15...