No download dialog with FileResult
- by majkinetor
I am returning File result from action triggered by the form post event.
I can't get download dialog. Instead, if I use:
return File(Encoding.UTF8.GetBytes(reportPath), "text/plain", "Report.csv");
I get path to the file upon ajax execution in the target div.
When I use
return File(reportPath, "text/plain", "Report.csv");
I get content of the file in the target div.
Any thoughts ?
The action is declared as
[HttpPost]
public virtual ActionResult ExportFilter(Model model) {
string outputFile = CreateReport(model);
return File(....)
}