Creating Zip file on client request..

May 27, 2011 at 10:59 AM
Edited May 27, 2011 at 11:01 AM


When I add to Zip big files it's take a long time until it's making a zipFile on running time,

Howto make the creation of the zip file faster on running time?

 I did this:



protected void btnDownload_Click(object sender, EventArgs e) 
        Response.ContentType = "application/zip"; 
        Response.AddHeader("content-disposition", "filename=" + ""); 
        using (ZipFile zip = new ZipFile()) 
            FileList objFileList = new FileList(); 
            objFileList = FileList.GetList(Convert.ToInt32(TextBox1.Text)); 
            for (int i = 0; i < objFileList.Count; i++) 
                zip.AddFile(Server.MapPath("~/Files/" + objFileList[i].UniqueFileName)); 
May 27, 2011 at 6:44 PM

It takes a long time to compress many many files.

If you do it often you can cache the results, and then you don't need to create the file, with each new request. 


May 27, 2011 at 8:43 PM

So I should Create the Zip file at server and save it for downloading it later?

that what ur telling me?


May 29, 2011 at 8:35 PM

Well yes, that is one way to make it faster.