在MVC中保存文件对话框

bla*_*kik 5 asp.net-mvc savefiledialog

如何在MVC应用程序中创建保存文件对话框?我找不到任何例子.

提前致谢.

Dar*_*rov 6

Content-Disposition在返回要下载的文件时使用标题附件:

public ActionResult Download()
{
    return File(@"c:\work\report.pdf", "application/pdf", "reoprt.pdf");
}
Run Code Online (Sandbox Code Playgroud)

或者,如果要动态生成要下载的文件:

public ActionResult Download()
{
    byte[] pdf = ... get the contents of the report
    return File(pdf, "application/pdf", "reoprt.pdf");
}
Run Code Online (Sandbox Code Playgroud)