DotNetZip and Windows Server 2008 64bit?

Oct 26, 2009 at 7:02 PM
Edited Oct 26, 2009 at 7:35 PM

I am fairly new to .net, and that's likely an understatement, as this is the first time I've really dug into it...

I am trying to get this running on Windows Server 2008 64bit version and was wondering if anyone has had any trouble getting it working?

If anyone has any experience they could pass to get it working be greatly appreaciated.

Here is what I have done so far.

- Installed from the MSI file

- registered the DLL with regsvr32 (just in case)

- and uploaded the DotNetZip-ASPNET-Example to it's own test domain setup through IIS

- and tested it out, and everything seems to be working


When I try to extract an uploaded file on the server it craps out.

Is there any extract samples out there? If anyone had a classic ASP sample that would be even better as the rest of the application is classic ASP.



Oct 26, 2009 at 7:59 PM
Edited Oct 26, 2009 at 8:07 PM

DB -

How do you try extract the uploaded file?

What do you mean "it craps out"?  how, exactly?  do you get an exception message?  what is it?

Have you verified that the uploaded zip is valid? Have you tried opening it in Windows Explorer, or some other tool?  (DotNetZip has a GUI tool that will open zips) 

In the doc for DotNetZip, there is a page that covers COM environments, and gives code examples.  You'll be able to use DotNetZip from ASP, just fine, if you follow those examples. There are vbscript and Javascript examples covering creation of zips and extract of zips.  You didn't say whether you were using VBScript or Javascript in the ASP pages, so I'm guessing VScript.  For example, here's extraction in vbscript:

dim zip 
set zip = Server.CreateObject("Ionic.Zip.ZipFile")
zip.Password = "This is the Password."

Oct 26, 2009 at 8:11 PM
Edited Oct 26, 2009 at 8:34 PM

Thanks Cheeso

I clearly missed the COM set up you listed in you reply.

As far as how I was trying it, I was referencing this as an example.

I'll try setting it up with COM and try again.




Oct 26, 2009 at 9:06 PM
Edited Oct 26, 2009 at 9:49 PM

Took a little digging, but I found the file to setup the DLL as a COM object, and got it working with your script sample from above.

A lot faster than the old method we were using.

Thanks again Cheeso

Oct 27, 2009 at 12:52 AM

Dave, glad it helped.

What was the setup you had missed?   The gacutil and regasm stuff?

If you run the Runtime MSI for DotNetZip, those two things - which are required for COM access - happen automatically for you.   If you don't run the MSI, like if you just install from the zip file, then you have to do the gacutil and the regasm stuff yourself. 


Oct 27, 2009 at 12:15 PM
Edited Oct 27, 2009 at 12:16 PM

I installed using the MSI, but I am guessing that it couldn't find gacutil and regasm when I ran it.
I coudn't locate gacutil on the server until after I installed the .NET SDK.
Neither call would work until I added the complete path before their file name.

I found gacutil here C:\Program Files\Microsoft.NET\SDK\v2.0 64bit\Bin
and regasm here C:\Windows\Microsoft.NET\Framework64\v2.0.50727

Once I added that in everything worked like a charm.

Oct 27, 2009 at 6:33 PM

Need some more help.

I'm trying to verify that the zip file has a file before extracting it, but for what ever reason it doesn't recognize the zip as having entries.

Here's a snippet of my asp code.

dim zip
response.write "Initialize Zip COM..."
set zip = CreateObject("Ionic.Zip.ZipFile")
response.write "Initialize " & tempPath & " ..."

For Each entry in zip
    fN = Right(entry.FileName,15)
    if (fN = "imsmanifest.xml") then
		response.write "Extract to " & tempPath2 & " ..."
		EXIT for
    end if

response.write "Dispose Zip COM..."

And this is the error I get when I run it.

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method

/asp/admin/content/scorm_uploader/tester.asp, line 14

Line 14 would be the beginning of the For statement. Any idea how to get this working?

Oct 27, 2009 at 8:52 PM

That doesn't make any sense to me.   The "for each" line just uses the enumerator on the ZipFile class, and it's definitely there.  This code worked for me:

<%@ LANGUAGE = VBScript %>
<%  Option Explicit             %>
<h1>ASP DotNetZip</h1>


dim tempPath
tempPath = Server.MapPath("fodder\")

dim tempPath2
tempPath2 = "c:\temp\"

dim zip
response.write "Initialize Zip COM...<br/>"
set zip = Server.CreateObject("Ionic.Zip.ZipFile")
response.write "Initialize " & tempPath & " ...<br/>"

dim entry, fN
For Each entry in zip
    response.write "Looking at entry " & entry.FileName & " ...<br/>"
    fN = Right(entry.FileName, 15)
    if (fN = "imsmanifest.xml") then
                response.write "Extract to " & tempPath2 & " ...<br/>"
                EXIT for
    end if

response.write "Dispose Zip COM...<br/>"



I had to make a couple modifications: I had to dim entry and fN - otherwise I would get an error about an undeclared variable (or something). Also, I could not, for the life of me, figure out the security on the ASP->COM ->.NET chain. The problem I was having was ASP 0177: Server.CreateObject failed (80070002). The 80070002 translates to "file not found", Sometimes that error was replaced with other ones. In the end I copied the Ionic.Zip.dll to %SYSTEMROOT\system32\inetsrv directory, and then ran regasm /codebase Ionic.Zip.dll from that directory; that allowed me to get past the Server.CreateObject() line. If you have already gotten past that, then you won't need to do this with Ionic.Zip.dll.  

Oct 28, 2009 at 2:48 PM

Is there another method I can use to read the zip contents? The 'for each entry' just doesn't want to work here for me at all. Doesn't seem to pick the zip file as having an array of files in it. Everything works fine if I take the for loop and file check out so I know it's not the zip file itself, I even tried with a new zip file created on the server with just the file I'm looking for in it and the for loop still kills the script.

Oct 28, 2009 at 6:21 PM

Enumerating through the zip file is the only way I know of to get a ZipEntry from within a COM environment, like ASP.  

What version of DotNetZip are you using?  Can you try out the latest v1.9?    (that's what I used)

I don't remember now, when I added the COM enumerator capability, but I am pretty sure it was prior to v1.8 . 


Oct 28, 2009 at 7:52 PM
Edited Oct 28, 2009 at 7:52 PM

Should I uninstall 1.8 before going to 1.9?

Oct 28, 2009 at 8:02 PM
Edited Oct 28, 2009 at 8:14 PM

yes, you should uninstall the existing v1.8, and then install v1.9.   I think the installer may automatically do that for you, but I didn't test it this time around.

I don't know for sure if this will fix the problems you're having, but it's worth a try.

Oct 30, 2009 at 2:47 PM

Updating to 1.9 didn't do the trick either, still can't parse through any zip files. Initializes and unzips, but won't step through the entries at all.

Could you show me how you'd write the above example in so I could try that instead?

Oct 30, 2009 at 6:56 PM

Dave, I don't understand what you mean by "won't step though the entries".  What does it do?  Are there actually entries in the zip file?

you might want to check out the documentation and the examples included in the source.

Does the enumeration work in regular VBScript run from CScript.exe ??  (There are examples for that, too, in the documentation.)


Nov 2, 2009 at 4:47 PM

Okay I update to 1.9, and nothing changed really.

Did a server reboot, and nothing changed right away.

Left everything alone over the weekend, and started looking at it again this morning.

Moved all my variable initializing outside the IF statement, and for some odd reason everything now works.

Not sure if it was the variables or what, but it works like a charm now.

Thanks for your help Cheeso.

Here's my code sample if anyone else needs it for reference later.



<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
Dim tempPath, tempPath2, fileToDownload
Dim zip, entry, fN

tempPath = Request.ServerVariables("APPL_PHYSICAL_PATH") & "uploads\"
tempPath2 = Request.ServerVariables("APPL_PHYSICAL_PATH") & "unZips\"
fileToLook4 = "imsmanifest.xml" 'SCORM manifest file to look for

   if tempPath <> "" Then
   		response.write("Instantiating another ZipFile object ...")
		set zip = Server.CreateObject("Ionic.Zip.ZipFile")
    	        response.write("Initialize (Read) ...")
		For Each entry in zip
       		        response.write("  " & entry.FileName & " ...")
			fN = Right(entry.FileName,15)
		        if fN = fileToLook4 then
				response.write("Found match, exporting files ...")
				EXIT for
			end if
                response.write("Export complete, close out ...")
	end if

set fN = nothing
set entry = nothing
set zip = nothing
set tempPath = nothing
set tempPath2 = nothing
set fileToDownload = nothing



Nov 3, 2009 at 2:25 AM

great! Glad it's working.

Nov 3, 2009 at 3:03 PM

Hey Cheeso

Any idea why it would hold on to control of the zip file after it was disposed?

I'm trying to delete the zip after it's been unpackaged, but it seems to be maintaining control of the zip file until I go in and restart the application pool in IIS, at which point I can manually delete the files.

Any idea what would cause this?

Thanks again



Nov 3, 2009 at 9:23 PM

Wassup Dave,

No, I don't have any good ideas on why the zipfile would remain locked.  The Dispose() call should close the file, and unlock it, as you would expect.  I can do some tests here to see if I can figure out why you're getting those results. 

But I won't be able to get to it today.  Soon though.

My plan is to use sysinternals' procmon to track the open/close on the zipfile.  If you feel like doing some additional investigation, that aveneue might be interesting.

I'll let ya know