title: Download CSV File by posting JSON data in ASP.NET MVC
body: <p>In ASP.NET MVC, I am trying to download a file via a post and sending JSON data.  This JSON data are filters for the data being displayed on the page via knockout.js.  The critieria object is always null.  How can I download a file, by sending post data via javascript or a form post?  Ive accomplished an ajax download by using a GET, but now I have extra data, like arrays I need to post.</p>
  
  <p><strong>Form</strong></p>
  
  <pre><code>&lt;form method="POST" action="@Model.ExportUrl" &gt;
      &lt;input type="hidden" name="criteria" data-bind="value: ko.toJSON(data())"  /&gt;
      &lt;button class="btn"&gt;&lt;i class="icon-download-alt"&gt;&lt;/i&gt; Export&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Request</strong></p>
  
  <pre><code>Request URL:http://localhost:2222/members/eventteams/export?eventId=8998
  Request Method:POST
  Status Code:500 Internal Server Error
  Request Headersview source
  Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Encoding:gzip,deflate,sdch
  Accept-Language:en-US,en;q=0.8
  Cache-Control:max-age=0
  Connection:keep-alive
  Content-Length:128
  Content-Type:application/x-www-form-urlencoded
  Host:localhost:2222
  Origin:http://localhost:2222
  Referer:http://localhost:2222/members
  User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36
  Query String Parametersview sourceview URL encoded
  eventId:8998
  Form Dataview sourceview URL encoded
  criteria:{"page":1,"pageSize":"100","sortOrder":"Team.Name","sortDirection":"ASC"}
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>[HttpPost]
  public virtual ActionResult Export(int eventId, DivisionTeamsTableCriteria criteria)
  {
  </code></pre>