I am getting a famous asp mvc error:
The required anti-forgery cookie "__RequestVerificationToken" is not present.
I am only getting this error when deploying my site to godaddy
server and only on the login page. However, all it takes is for me to refresh the page and the error is gone.
Thus, i trying to figure out how to check if this cookie exists and run:
location.reload(true);
if cookie does not exist, which i think will solve the problem.
So i tried to use:
if(!$.cookie('__RequestVerificationToken')){
location.reload(true);
}
But the cookie
is always undefined
and the above code keeps reloading the page.
I have checked almost every SO question relating to this problem and cannot seem to find the answer.