title: No download dialog with FileResult
body: <p>I am returning File result from action triggered by the form post event.
  I can't get download dialog. Instead, if I use:</p>
  
  <pre><code>return File(Encoding.UTF8.GetBytes(reportPath), "text/plain", "Report.csv");
  </code></pre>
  
  <p>I get path to the file upon ajax execution in the target div.</p>
  
  <p>When I use </p>
  
  <pre><code>return File(reportPath, "text/plain", "Report.csv");
  </code></pre>
  
  <p>I get content of the file in the target div.</p>
  
  <p>The action is declared as</p>
  
  <pre><code>   [HttpPost]
     public virtual ActionResult ExportFilter(Model model) {
        string outputFile = CreateReport(model);
        return File(....)
     }
  </code></pre>
  
  <p>The form is submited via Ajax.BeginForm(...).</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>A bit more info: My form has 2 submit buttons. One is used to present result in the target div, the other one is used to export the result. The actton is the same and I use this to determine which button triggered the event:</p>
  
  <pre><code>        [HttpPost]
          public virtual ActionResult Run( model )
          {
              var bExecute = !string.IsNullOrEmpty(Request.Form["execute"]);
              return bExecute ? Execute(model) : Export(model);
          }
  
          [HttpPost]
          public virtual ActionResult Execute( model )
          {
              ....
              return PartialView("Report", model); 
          }
  
         [HttpPost]
         public virtual FileResult Export( model ) {
                  .....
                 return File(....)
         }
  </code></pre>
  
  <p>After some answers I tried to redirect to Get action using :</p>
  
  <pre><code>   ....
      return RedirectToAction( MVC.Report.OfferDownload(ReportFile) );
  }
  
      [HttpGet]
      public virtual FileResult OfferDownload(string FileName)
      {
          return File(FileName, "text/csv", "Report.csv");
      }
  </code></pre>
  
  <p>However, that didn't help.</p>
  
  <p>I also tried to Stream file, but it didn't help too.</p>
  
  <p><strong>EDIT2</strong> </p>
  
  <p>Definitely Ajax problem cuz it works when I replace Ajax.BeginForm with Html.BeginForm. One solution I have in mind is to use onclick event on submit buttons to change form attributes.</p>