title: ValidateAntiForgeryToken in asp.net mvc 5.0 - how to pass array of objects with JSON and ajax
body: <p>It seems that <code>ValidateAntiForgeryToken</code> attribute prevents the data from being parsed properly when passed to MVC Controller, the code below works when I remove the <code>ValidateAntiForgeryToken</code> attribute but does not work with it, all the parameters in the controller action are passed except array of translations.</p>
  <p>Please advise on how to pass array of objects while utilizing <code>ValidateAntiForgeryToken</code> attribute, is it even possible?</p>
  <p>This is my code</p>
  <p>C#</p>
  <pre><code> [HttpPost]
   [ValidateAntiForgeryToken]
   public void AddComment( string code, string type, string ecomment, IEnumerable&lt;CommentTranslation&gt; translations) 
    {
              //do something later
     }
  </code></pre>
  <p>CommentTranslation is</p>
  <pre><code>public class CommentTranslation
      {
          public string LangId { get; set; }
          public string LangName { get; set; }
          public string Translation { get; set; }
      }
  </code></pre>
  <p>js</p>
  <pre><code>addComment: function (ecomment, type, translations) {
  
  
          var data = {           
                  code: '',
                  type: type,
                  ecomment: ecomment,
                  translations: translations
          };
  
          var url = 'CommentsAjax/AddComment';
          return comments.repository.postDataWithToken(data, url);
      },
  
    postDataWithToken: function (data, url) {
          
          return $.ajax({
              type: 'POST',
              traditional: true,
              contentType: 'application/x-www-form-urlencoded; charset=utf-8',
              data: comments.repository.addAntiForgeryToken(data),
              url: getServerPath() + url
          });
      }
  
  
  addAntiForgeryToken: function (data) {
      var token = $('input[name=&quot;__RequestVerificationToken&quot;]').val();
      data.__RequestVerificationToken = token;
      return data;
  },
  </code></pre>