ASP.NET MVC Validation of ViewState MAC failed

前端 未结 3 698
星月不相逢
星月不相逢 2020-12-13 02:46

After publishing a new build of my ASP.NET MVC web application, I often see this exception thrown when browsing to the site:

System.Web.Mvc.HttpAntiForgeryException:

3条回答
  •  借酒劲吻你
    2020-12-13 03:23

    I too had this problem, and expecting the users to clear their cache, cookies or refreshing the page isn't acceptable.

    Adding a machinekey to web.config is will fix this. I used this tool to quickly generate a key so I don't see these errors in development and then I generate one properly when the site goes into production.

    http://aspnetresources.com/tools/machineKey

提交回复
热议问题