I am running IIS 8.5 on a load-balanced (two-node) web farm. We are getting sporadic errors:
System.Web.Mvc.HttpAntiForgeryException (0x80004005): The anti-forgery
token could not be decrypted....
I have tried/checked various solutions:
- At the server-wide level, I created explicit validation and decryption keys as described here, and have synchronized them across both nodes. One thing to note is that for now, I left "Generate a unique key for each application" unchecked.
- The token is only generated once per page to avoid the problem described here.
But the errors persist.
What can I do next to troubleshoot?
EDIT:
Controller code:
[HttpGet]
public ActionResult Index()
{
var model = new LoginModel();
return View(model);
}
Relevant view code:
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<h1>Log In</h1>
<fieldset>
<label>Email</label>
@Html.TextBoxFor(model => model.Username)
<label>Password</label>
@Html.PasswordFor(model => model.Password)
<input type="submit" />
</fieldset>
}