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

Sometimes this error isn’t what you think.

I had dutifully put the “@Html.AntiForgeryToken()” call in the Views, and then attached the “[ValidateAntiForgeryToken]” tag to the right events. On the staging server, all was well, but when I debugged the project locally, I was getting the error.

A change to my web.config was the problem. I had added the following tag:

<httpCookies requireSSL="true" />

The problem was that when debugging locally, my system didn’t use SSL. Removing this tag from the debug build worked.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: