【发布时间】:2011-10-15 16:41:04
【问题描述】:
我的控制器操作方法将 pdf 文件返回为
public FileContentResult GetPDF(string filename)
{FileContentResult filecontent= new FileContentResult(Contents, "application/pdf");
HttpContext.Response.AddHeader("Content-Disposition", "inline; filename=" + filename);
return filecontent;
}
现在,它没有在浏览器选项卡中打开,所以我想在最后以 filename.pdf 的形式返回 url,这就是我可以在浏览器选项卡中打开 pdf 的方式。那么我该如何将它添加到我现有的操作方法中。
谢谢,
迈克尔
【问题讨论】:
标签: asp.net-mvc pdf http-headers pdf-generation