Hi All,
I need to send the client a zipped file which will contain the contents of a dataset (trying to zip an excel file).
I created a String from the dataest with proper delimeters, then I converted the string to a byte array.
Then I zipped the byte array using GZipStream.
So far, so good (i think).
Next, I am doing the following:
1 Response.ClearContent();
2 Response.ClearHeaders();
3 Response.Clear();
4 //Response.ContentType = "application/x-zip-compressed";
5 Response.ContentType = "application/x-gzip-compressed";
6
7 Response.AddHeader("Content-Disposition", "attachment; filename=" + "excel.xls" + ".zip");
8 Response.AddHeader("Content-Length", byteArr.Length.ToString());
9
10 Response.BinaryWrite(byteArr);
11
12 Response.Flush();
13 Response.End();
The problem is that the zip file is created but it won't open using windows standard compressed zip application. I receive "The Compressed (zipped) Folder is invalid or corrupted".
If I use "FileZip" it opens correctly.
Any ideas why it isn't opening properly with windows standard zip?
Thanks in adnvace !
I need to send the client a zipped file which will contain the contents of a dataset (trying to zip an excel file).
I created a String from the dataest with proper delimeters, then I converted the string to a byte array.
Then I zipped the byte array using GZipStream.
So far, so good (i think).
Next, I am doing the following:
1 Response.ClearContent();
2 Response.ClearHeaders();
3 Response.Clear();
4 //Response.ContentType = "application/x-zip-compressed";
5 Response.ContentType = "application/x-gzip-compressed";
6
7 Response.AddHeader("Content-Disposition", "attachment; filename=" + "excel.xls" + ".zip");
8 Response.AddHeader("Content-Length", byteArr.Length.ToString());
9
10 Response.BinaryWrite(byteArr);
11
12 Response.Flush();
13 Response.End();
The problem is that the zip file is created but it won't open using windows standard compressed zip application. I receive "The Compressed (zipped) Folder is invalid or corrupted".
If I use "FileZip" it opens correctly.
Any ideas why it isn't opening properly with windows standard zip?
Thanks in adnvace !