title: Anti forgery system on ASP.Net MVC
body: <p>When I'm putting following code:</p>
  
  <pre><code> @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
      {
          @Html.AntiForgeryToken()
          &lt;a href="javascript:document.getElementById('logoutForm').submit()"&gt;Log off&lt;/a&gt;
      }
  </code></pre>
  
  <p>the </p>
  
  <pre><code>@Html.AntiForgeryToken()
  </code></pre>
  
  <p>part is thrownig following exception:</p>
  
  <p><em>The provided identity of type 'System.Web.Security.FormsIdentity' is marked IsAuthenticated = true but does not have a value for Name. By default, the anti-forgery system requires that all authenticated identities have a unique Name. If it is not possible to provide a unique Name for this identity, consider setting the static property AntiForgeryConfig.AdditionalDataProvider to an instance of a type that can provide some form of unique identifier for the current user.</em></p>
  
  <p>I've checked many examples and tried to search the web, but I cannot find any explanation. I would like to know why this error happens to me? And how to solve it to use antiforgery.</p>