Click here to Skip to main content
12,560,765 members (53,469 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
I have a folder that is created by some service.
It contains multiple sub-folders.
I want to give the provision to the users of a website to download the entire folder as a single zip file without needing to create and store the zip file in the system.
That is create a temporary zip file and push it to the user.

Thanks in advance.
Posted 1-Jun-12 1:14am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I believe this article will give you exactly what you are looking for:[^]

Right now I believe you still have to use that third party library but in .NET 4.5, you can do this without a library because it is built in. I did an article on zip files in .NET 4.5 recently, although I didn't discuss the web side of things. It might be of use to you in your planning, depending on if you want to use the latest version of .NET or not. Here is a link to the article, in case you are interested: Creating Zip Files Easily in .NET 4.5[^]
Prasad_Kulkarni 1-Jun-12 7:34am
Good link +5!
I din't got this link..
shivprasadshetty 1-Jun-12 7:48am
Yes this one is working pretty fine but my folder has multiple folders in it and how to add those folder to zip??
This might be a simple question though
Prasad_Kulkarni 1-Jun-12 8:10am
This might be a simple question though
Sounds rude!
Tim Corey 1-Jun-12 8:37am
You can just add the root folder and all the folders underneath will be added (or each root folder if there are multiple in the root directory). There is documentation on how to add a folder, but here is a quick example I found:
Oleksandr Kulchytskyi 1-Jun-12 8:01am
SharpZilLib have ablity to compress multiple folders in parent.
shivprasadshetty 1-Jun-12 9:36am
Thanks a lot Oleksandr and Tim
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You might look forward to SharpZipLib i think with help of this library you could compress entire folder with subfolders and files.
Good luck.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161026.1 | Last Updated 1 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100