title: ASP.NET MVC Controller FileContent ActionResult called via AJAX
body: <p><strong>The setup</strong>:</p>
  <p>The controller contains a method <code>public ActionResult SaveFile()</code> which returns a <code>FileContentResult</code>.</p>
  <p><strong>What works</strong>:</p>
  <p>The view contains a form, which submits to this action. The result is this dialog:<img src="https://i.stack.imgur.com/5xpNy.png" alt="enter image description here" /></p>
  <p><strong>What doesn't work</strong>:</p>
  <p>The view contains some javascript to do an AJAX call to the same controller action where the form would post. Rather than triggering the aforementioned dialog, or even the AJAX success function, the response triggers the AJAX error function, and the <code>XMLHttpRequest.responseText</code> contains the file response.</p>
  <p><strong>What I need to do:</strong></p>
  <p>Make the request for the file using AJAX, and end up with the same result as when submitting a form. How can I make the AJAX request provide the dialog that submitting a form shows?</p>