'C3 - Create and download ZIP file with Excel workbook
I am generating XLS files on the Server. Then I am zipping them up and streaming the ZIP back. Here is code:
using (var archive = new ZipArchive(zipFile, ZipArchiveMode.Create))
{
// ZIP file is created here
}
Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=test.xls");
Response.ContentType = "application/vnd.ms-excel";
Response.BinaryWrite(File.ReadAllBytes(zipPath));
Response.Flush();
Response.Close();
The ZIP is created and downloaded successfully. When I try opening Excel file from the zip I am getting this:

After saying Yes it will open fine.
Any idea what am I doing wrong?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
