我有一个Web应用程序,在单击事件上流式传输PDF文件,它在IE,Firefox和Safari中正常工作,但在Chrome中它永远不会下载。下载只是“中断”。 Chrome是否处理流式传输?我的代码看起来像:从Google应用程序流式MIME类型'应用程序/ pdf'在谷歌浏览器中失败
this.Page.Response.Buffer = true;
this.Page.Response.ClearHeaders();
this.Page.Response.ClearContent();
this.Page.Response.ContentType = "application/pdf";
this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName);
Stream input = reportStream;
Stream output = this.Page.Response.OutputStream;
const int Size = 4096;
byte[] bytes = new byte[4096];
int numBytes = input.Read(bytes, 0, Size);
while (numBytes > 0)
{
output.Write(bytes, 0, numBytes);
numBytes = input.Read(bytes, 0, Size);
}
reportStream.Close();
reportStream.Dispose();
this.Page.Response.Flush();
this.Page.Response.Close();
有关我可能会丢失什么的任何建议?
有用的*** Android ***和_Chrome_:'Android和HTTP下载文件头' http://www.digiblog.de/2011/04/android-and-the-download-file-headers/ http://stackoverflow.com/questions/4674737/avoiding-content-type-issues-when-downloading-a-file-via-browser-on-android/5728859#comment46671021_5728859 – Kiquenet 2017-01-25 15:39:56