title: Automatically add anti-forgery tokens in ASP.NET MVC with Razor
body: <p>To prevent Cross-site request forgery you need to add an anti-forgery token to every form.</p>
  
  <pre><code>@using (Html.BeginForm()) 
  {
      @Html.AntiForgeryToken()
  }
  </code></pre>
  
  <p>I would like to avoid adding <code>@Html.AntiForgeryToken</code> to all forms. Is there a way to automate this process?</p>
  
  <p>The German <a href="https://de.wikipedia.org/wiki/Cross-Site-Request-Forgery#Serverseitig" rel="nofollow noreferrer">Wikipedia article</a> (<a href="https://i.stack.imgur.com/kLLer.png" rel="nofollow noreferrer">Image</a>) states a hidden field with the token will be added automatically after <code>@Html.BeginForm</code>, but it looks like this is not correct.</p>