Anti-Forgery Request Helpers for ASP.NET MVC and jQuery AJAX
- by Dixin
Background
To secure websites from cross-site request forgery (CSRF, or XSRF) attack, ASP.NET MVC provides an excellent mechanism:
The server prints tokens to cookie and inside the form;
When the form is submitted to server, token in cookie and token inside the form are sent in the HTTP request;
Server validates the tokens.
To print tokens to…