Friday, January 17, 2014

Create Zip File in ASP.NET using "Ionic.zip.dll" with Example

Step 1:

Ionic.zip.dll Download  and right-click on "Bin" folder of your project and select "Add Reference" select this "Ionic.zip.dll" file and click Add. It will add Ionic.zip.dll into your project.
Make following folder structure in your Project-


Step 2:

In Design Page write following code :


Step 3: 

In Code (.cs) Page write following code :

zip.AddFiles(filenames,date);
"date" used for folder name where these files will be stored inside ZIP.

If you want to delete all files inside folder "ZipMyFiles" use following code-


If you want large file to Upload and ZIP then follow step 4.
Step 4:
In web.config file write following setting: