SolanumVexus wrote:
I was getting a very similar error when downloading Excel files from an ASP.NET site. Turns out I also needed the Content-Length header. Here's a code snippet: MemoryStream stream = export.ExportEx(types, ids); Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"; Response.AddHeader("content-disposition", "attachment;filename=\"AnalysisExport.xlsx\""); Response.AddHeader("Content-Length", stream.Length.ToString()); stream.WriteTo(Response.OutputStream); stream.Close();Thank you SolanumVexus. You solved my problem with the Content-Length header.