How to use DotNetZip within an ASP.NET Application?

May 24, 2008 at 7:55 PM

I have downloaded your library and try implement to my application (ASP.NET)

However, I had no idea how to start and where should the lib stored at.
Besides, I don't know how to define it at the aspx pages at the first of the
beginning. I use VB.NET, and sometimes C#, how to import the name space?

I had tried the following

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.IO.Compression" %>
<%@ Import Namespace="System.IO.Compression.DeflateStream" %>
<%@ Import Namespace="Ionic.Utils.Zip" %>

and put the lib in the root level of the webserver, however, the browser
report the error like this

Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'ZipFile' is not defined.

Source Error:

Line 722:        f = Server.MapPath(mypath & myFile)
Line 723:
Line 724:        Dim zip As New ZipFile("c:\", System.Console.Out)
Line 725:        Try
Line 726:            zip.AddFile(f, Server.MapPath(mypath))
Line 727:            'zip.AddFile(f, True)
Line 728:            'zip.Save()

Warning: BC40056: Namespace or type specified in the Imports
'Ionic.Utils.Zip' doesn't contain any public member or cannot be found. Make
sure the namespace or the type is defined and contains at least one public
member. Make sure the imported element name doesn't use any aliases.
Source Error:

Line 13: Option Explicit On
Line 14:
Line 15: Imports Ionic.Utils.Zip
Line 16: Imports Microsoft.VisualBasic
Line 17: Imports System

Can you kind to answer me how to use your lib?

Thanks and regards
May 24, 2008 at 7:55 PM
Hi -
Deployment of the Ionic.Utils.Zip.dll into an ASP.NET application is the same as deployment of any DLL into an ASP.NET application.
Copy the DLL to the \bin subdirectory in the ASP.NET application directory.

Read this:

Also - This is the kind of question to ask on the Forums.