In this article I will explain how to Upload, Unzip and Extract contents Zip Archive file in ASP.Net using C# and VB.Net. In order to Unzip and Extract contents of Zip Archive file in ASP.Net I am making use of DotNetZipLibrary which is a free Open Source Library for .Net.

The files are extracted in a folder on server and then displayed in GridView.
 
Referencing the DotNetZip Library
You will need to download the

DotNetZip Library DLL using the Download Link provided below.
Download DotNetZip Or your will find the DLL in the attached sample at the end of the article.
Once you have the DLL you need to place the Ionic.Zip.Reduced.dll in the BIN Folder.
 
Namespaces
You will need to import the following Namespaces
C#
using System.IO;
using Ionic.Zip;
using System.Collections.Generic;
 
VB.Net
Imports System.IO
Imports Ionic.Zip
Imports System.Collections.Generic
 
 
HTML Markup
The HTML Markup consists of an ASP.Net FileUpload control, a Button and a GridView control.
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="btnUpload" Text="Upload" runat="server" OnClick="Upload" />
<hr />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" HeaderStyle-BackColor="#3AC0F2"
    HeaderStyle-ForeColor="White" RowStyle-BackColor="#A1DCF2">
    <Columns>
        <asp:BoundField DataField="FileName" HeaderText="File Name" />
        <asp:BoundField DataField="CompressedSize" HeaderText="Compressed Size (Bytes)" />
        <asp:BoundField DataField="UncompressedSize" HeaderText="Uncompressed Size (Bytes)" />
    </Columns>
</asp:GridView>
 
 
Upload, Unzip and Extract contents of Zip Archive File in ASP.Net
Once the Zip file is uploaded it is read using the DotNetZip ZipFile Read method to which I have passed the InputStream object of the FileUpload PostedFile property.
Then the Zip File is extracted to the folder. The Extract All method has an additional parameter ExtractExistingFileAction, for which I have specified DoNotOverwrite so that if a file with same name exists, it will not be overwritten.
C#
protected void Upload(object sender, EventArgs e)
{
    string extractPath = Server.MapPath("~/Files/");
    using (ZipFile zip = ZipFile.Read(FileUpload1.PostedFile.InputStream))
    {
        zip.ExtractAll(extractPath, ExtractExistingFileAction.DoNotOverwrite);
        GridView1.DataSource = zip.Entries;
        GridView1.DataBind();
    }
}
 
VB.Net
Protected Sub Upload(sender As Object, e As EventArgs)
    Dim extractPath As String = Server.MapPath("~/Files/")
    Using zip As ZipFile = ZipFile.Read(FileUpload1.PostedFile.InputStream)
        zip.ExtractAll(extractPath, ExtractExistingFileAction.DoNotOverwrite)
        GridView1.DataSource = zip.Entries
        GridView1.DataBind()
    End Using
End Sub
 
Note: If you want to learn how to download files from folder. Please refer
 
Upload, Unzip and Extract contents Zip Archive file in ASP.Net using C# and VB.Net
 
Downloads