Yet Another Blog on ASP.NET and Some Other Stuff

Extract Zip File By Using SharpZipLib Library in ASP.NET

Posted in ASP.NET, VB.NET, Web Development by Mustafa Basgun on February 8th, 2008

If you are developing an IO style application, it is a high possibility that one of the requirements would ask you a utility to extract an uploaded zip file. Well, here is a one way to accomplish this with VB.NET by using the SharpLibZip library.

After downloading the appropriate binary file and placing it to the Bin directory of your project, let’s have the webform similar to the following:

HTML presentation of this webform should look like:

Click event of Button1 is the one using the ExtractZip class:

Now, time to delve into the ExtractZip class! Code speaks pretty well for itself, therefore I will not be putting detailed description. Parameters are:

Before jumping into the extraction, it would be a good practice to perform some simple checks:

And, the Try Catch statement doing the main job is:

Delete the original zip file if the optional DeleteZip parameter was left as True:

Download

Working sample of this ExtractZip class can be downloaded via here.

One Response to 'Extract Zip File By Using SharpZipLib Library in ASP.NET'

Subscribe to comments with RSS or TrackBack to 'Extract Zip File By Using SharpZipLib Library in ASP.NET'.

  1. Jack said, on July 3rd, 2008 at 5:04 am

    Brilliant.

Leave a Reply