Asp.net Zip inside Zip Issue

Nov 12, 2010 at 8:02 PM

Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.BufferOutput= false;
Response.ContentType = "application/zip";
//Response.ContentType = "application/octet-stream";                
Response.AddHeader("content-disposition", "filename=" + archiveName);
using (ZipFile zip = new ZipFile())
{
	foreach (var f in filesToInclude)
        {
                  zip.AddFile(f,"files");
        }
        zip.AddEntry("Readme.txt", ReadmeText);
        zip.Save(Response.OutputStream);
}
Response.End();

 I am using above code to zip the file and download the file. The code works fine on localhost. But if i install on server then the downloaded zip file is zipped twice. Default Windows compression Extract All not work and even with Winzip it is not working. From WinRar i came to know that it is creating a zip file of the zip file with the same name. Have any idea where i am wrong in this code?

 

Nov 12, 2010 at 8:38 PM

I tried with Response.ContentType = "application/octet-stream";  and it is working now for me. I dont know what is happening at IIS.