No download dialog with FileResult
Posted
by majkinetor
on Stack Overflow
See other posts from Stack Overflow
or by majkinetor
Published on 2010-03-22T19:14:55Z
Indexed on
2010/03/22
19:21 UTC
Read the original article
Hit count: 230
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(....)
}
© Stack Overflow or respective owner