The required anti-forgery cookie “__RequestVerificationToken” is not present

前端 未结 8 1236
伪装坚强ぢ
伪装坚强ぢ 2021-02-01 03:31

My website is raising this exception around 20 times a day, usually the form works fine but there are instances where this issue occur and I don\'t know why is so random.

<
8条回答
  •  感情败类
    2021-02-01 03:53

    Ran into similar issue recently. The anti-forgery cookie indeed was missing, so (as others pointed out) either

    1. the server did not add the cookie to request, or
    2. the browser rejected it.

    In my case, it was the server: I was not using SSL on local environment, yet in web.config I had the following line:

    
    

    Solution in this case is to either switch to SSL, or keep the value set to 'False' for local environment.

提交回复
热议问题