我试图PDF文件返回给浏览器标题Content-Dispostion:inline
权,我创建这个文件之后。 浏览器的观众有问题,将其打开。
文件没有损坏。 如果我投入的浏览器,浏览器显示文件正确。 但我想创建文件,并在一个请求检查用户权限的文件。
这里是我的头和响应设置:
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline");
HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");
HttpContext.Current.Response.AddHeader("filename", $"objednavka-{OrderId}.pdf");
HttpContext.Current.Response.BinaryWrite(File.ReadAllBytes(filePath));
HttpContext.Current.Response.End();
火狐有错误的文件viewer.js,消息不确定,线1453。
在Firefox中的调试器响应网络是200 OK。
但在浏览器消息是连接丢失(所中断)。