Zipping the download files on the fly ASP.Net (real-time zip and download file from server)

I am currently working on an ASP.Net web project, which allows client to download a well structured submission package. Due to security reason, web server can not create folder and write file on client side. Web server can generate a well structured zipped file and push to the client.

There could be two ways to achieve that;

Fist way:

  1. Create folders and copy files into each folder
  2. Use 3rd party tool, eg winrar, 7zip to zip the whole folder to one zipped file
  3. Send back download web address, and let client download the zipped file

If the zipped file is small and web server is powerful enough, client won’t feel any delay. However if the file is big, client side will get no any response until zip file is ready. We can put similar message, eg “Please wait… ”. But client side still don’t know how long would take. If zip file is not ready within time out period, server will get reset. This is a really awful user experience.

Second way:

  1. Create folder and zip the files on the fly (on web server’s memory)
  2. Send back zipped stream to client through Response
  3. Client download  zipping file one by one

Client can clearly feel the progress of downloading.

Here is the code for 2nd solution:

//prepare response header
//set Response Content Type
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;");
ZipOutputStream zipOutput = new ZipOutputStream(Response.OutputStream);
            zipOutput.IsStreamOwner = false;
            //set compress level

            ArrayList fileList = functions.GetFileList();
            foreach (string fileName in fileList)
                string folderName = "folder1" + @"";

                zipEntry = new ZipEntry(folderName + fileName);
                byte[] file = functions.GetFile(fileName);
                //zip file
                zipOutput.Write(file, 0, file.Length);
                 //send to client for downloading
        catch (Exception ex)

CeBIT Australia at Sydney Darling Harbour

CeBIT is the world’s largest and most international computer expo, and is a traditional computer show held every year. As it grows quickly, CeBIT Australia becomes bigger and bigger. Lots of IT equipment suppliers join this trade show, eg DELL, Samsung, Hitachi, D-Link, etc. This year, CeBIT 2011 starts yesterday and is held for 3 days.

Samsung huge LCD display and show stand

D-Link and its Ethernet router



Pronto software

CSRIO is displaying their 3D detect system

Waterproof LCD monitor

Other stands



The only disappointing is  no world-wide largest IT manufacture, eg IBM, Intel, NVidia. I didn’t see many emerging technologies.