我想在浏览器中以 pdf 格式显示系统的用户手册。
以下代码在 IE9 中工作正常,但不是
Chrome - 从服务器收到的错误重复错误
Firefox - 损坏的内容错误
MVC 5 代码(我认为是添加 IE 可以处理的重复标头)
只是想知道有什么方法可以适用于所有浏览器吗?
public FileResult UserManual()
{
var FileName = "user-manual.pdf";
var cd = new ContentDisposition
{
Inline = true,
FileName = FileName
};
Response.AddHeader("Content-Disposition", cd.ToString());
string path = AppDomain.CurrentDomain.BaseDirectory + "App_Data/";
return File(path + FileName, MediaTypeNames.Application.Pdf, FileName);
}
Run Code Online (Sandbox Code Playgroud)