У меня есть веб-приложение, которое передает потоковый файл PDF по событию щелчка, оно отлично работает в IE, Firefox и Safari, но в Chrome его никогда не загружают. Загрузка только читает "Прерванный". Chrome обрабатывает потоковую передачу по-другому? Мой код выглядит так:
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();
Какие-нибудь предложения относительно того, что я мог бы пропустить?