I have MVC 4 application whose app pool is stopping every now and then. I see this exception in the Event Viewers Windows Application logs Exception information:
Exception type: HttpAntiForgeryException
Exception message: The anti-forgery cookie token and form field token do not match.
.....................
My controller action has ValidateAntiForgeryToken setup like below
[HttpPost]
[ValidateAntiForgeryToken]
[OutputCache(Duration = 0)]
public ActionResult Login(LoginViewModel model, string returnUrl, bool loginbutton = true)
{
///
}
And on my form in view I do have
@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", @id = "login-form" }))
{
@Html.AntiForgeryToken()
....................
}
I have looked into this question and added machine key but that does not help either. Any ideas why this could be happening? The site is using SSL certificate but I don't think that could cause any issues.