A required anti-forgery token was not supplied or was invalid

After adding the AntiForgeryToken to prevent Cross Site Request Forgery, I started getting the following message when I was debugging the site

“A required anti-forgery token was not supplied or was invalid.”

With the following inner exception

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

After Googling around for a bit and trying many other options, a much simpler and quick solution rose, clearing the cookies. There are some fixes and additional info about the issue, but this is a quick fix/hack for somebody who needs to move past quickly.

Jacob Saylor

Software developer in Kentucky

1 Response

  1. Hopefully you didn’t spend too much time Googling. I get this quite a bit from site to site, it’s amazing the goodness that can come from clearing cache, cookies, etc…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: