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)
| 归档时间: |
|
| 查看次数: |
7619 次 |
| 最近记录: |