title: Get the raw values (not html) from AntiForgeryToken()
body: <p>This beautiful abstraction lets you place <code>@Html.AntiForgeryToken()</code> in cshtml file which is magically expanded to something like;</p>
  
  <pre><code>&lt;input name="__RequestVerificationToken" type="hidden" value="JjMHm5KJQ/qJsyC4sgifQWWX/WmADmNvEgHZXXuB07bWoL84DrmQzE6k9irVyFSJ5VSYqeUIXgl4Dw4NHSotLwflGYTyECzLvrgzbtonxJ9m3GVPgUV7Z6s2Ih/klUB78GN7Fl4Gj7kxg62MEoGcZw175eVwTmkKJ0XrtEfD5KCVvYIMHNY8MT2l+qhltsGL87c9dII42AVoUUQ2gTvfPg==" /&gt;
  </code></pre>
  
  <p>By mvc before the page is served. However my page has some JavaScript making ajax calls which don't include the token even though it's been added to the form. They are currently getting the expected <code>[HttpAntiForgeryException]: A required anti-forgery token was not supplied or was invalid.</code> because they don't have the token. I'm aware I <em>could</em> parse the value out of the DOM but I shouldn't have to. Are there other ways of accessing/getting this value? To be clear, I mean I'd like an overload of the method that returns just the value as a string or some kind of object that has the name and value both.</p>
  
  <p>To provide a bit more context my form and the relevant JS looks a little like this;</p>
  
  <pre><code>&lt;form action="/settings" method="post"&gt;&lt;input name="__RequestVerificationToken" type="hidden" value="JjMHm5KJQ/qJsyC4sgifQWWX/WmADmNvEgHZXXuB07bWoL84DrmQzE6k9irVyFSJ5VSYqeUIXgl4Dw4NHSotLwflGYTyECzLvrgzbtonxJ9m3GVPgUV7Z6s2Ih/klUB78GN7Fl4Gj7kxg62MEoGcZw175eVwTmkKJ0XrtEfD5KCVvYIMHNY8MT2l+qhltsGL87c9dII42AVoUUQ2gTvfPg==" /&gt;    &lt;fieldset&gt;
          &lt;h3&gt;User Settings&lt;/h3&gt;
          &lt;ul&gt;
              &lt;li&gt;
              label for="password"&gt;Password&lt;/label&gt;
                  &lt;a href="#" id="change_password" class="changePasswordButton"&gt;Edit&lt;/a&gt;
                  &lt;div id="password_section" class="inlineedit"&gt;
                      &lt;div&gt;
                          &lt;span for="existing_password"&gt;Current password&lt;/span&gt; &lt;input autocomplete="off" class="required" id="existing_password" name="existing_password" type="password" /&gt;
                      &lt;/div&gt;
                      &lt;div&gt;
                          &lt;span for="new_password"&gt;New password&lt;/span&gt; &lt;input autocomplete="off" class="required" id="new_password" name="new_password" type="password" /&gt;
                          &lt;span id="password_strength" /&gt;
                      &lt;/div&gt;
                      &lt;div&gt;
                          &lt;span for="confirm_password"&gt;Confirm password&lt;/span&gt; &lt;input autocomplete="off" class="required" id="confirm_password" name="confirm_password" type="password" /&gt;
                      &lt;/div&gt;
                      &lt;div class="inlinesave"&gt;
                          &lt;input type="button" value="Change" onclick="onPostChangePassword();"/&gt;
                          &lt;a href="#" id="cancel_password" class="cancel"&gt;Cancel&lt;/a&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
      // a bunch more of these that call their own onPostChangeSetting method
  </code></pre>
  
  <p><code>onPostChangePassword()</code> does some input validation then;</p>
  
  <pre><code> if(validPWD &amp;&amp; validNewPWD &amp;&amp; validConfirmPWD &amp;&amp; current_pwd != new_pwd){
                          // Post the password change
                          var currentAjaxRequest = $.ajax({
                              type: "POST",
                              url: "/settings/preferences/changepassword",
                              cache: false,
                              data: {password: $('#new_password').val(), current: $('#existing_password').val(),confirm: $('#confirm_password').val()},
                              success: password_success,
                              error: password_error,
                              dataType: "json"
                          });
                          return true;
                    }
  </code></pre>
  
  <p>Which ideally (since this is verbatim in a cshtml file) would be modified with something like this;</p>
  
  <pre><code>data: {password: $('#new_password').val(), current: $('#existing_password').val(),confirm: $('#confirm_password').val(),
  __RequestVerificationToken:@Html.AntiForgeryValue() }
  </code></pre>
  
  <p>tl;dr is there a way to interact with the AntiForgeyToken before it's turned into an string of html?</p>