The anti-forgery cookie token and form field token do not match in MVC 4

后端 未结 6 1168
青春惊慌失措
青春惊慌失措 2020-12-02 17:11

I\'m using the default login module in ASP.NET MVC 4. I did not change any code in the default application and i hosted it on a shared server.

After i logged in usin

6条回答
  •  情歌与酒
    2020-12-02 17:39

    I resolved the issue by explicitly adding a machine key in web.config.

    Note: For security reason don't use this key. Generate one from https://support.microsoft.com/en-us/kb/2915218#AppendixA. Dont use online-one, details, http://blogs.msdn.com/b/webdev/archive/2014/05/07/asp-net-4-5-2-and-enableviewstatemac.aspx

     
    

    Here's a site that generates unique Machine Keys:

    http://www.developerfusion.com/tools/generatemachinekey/

提交回复
热议问题