CSRF – AntiForgeryToken and AJAX

Below shows how to apply an Cross Site (anti) Forgery – CSRF) token to MVC page that posts data using Ajax. This is converted from the following stackoverflow question here. First wire up the ajax call and check it works. Then add the [ValidateAntiForgeryToken] and [HttpPost] attribute to your action in the controller. At this […]