After much fruitless searching, DotNetZip has turned out to be a cost effective solution to providing a simple Zip/Unzip COM solution for classic ASP pages on a Win2003 x64 platform. Having got it working I thought I should pass on a few tips so that others
aren't faced with the same time consuming process that I was.
First - installation. The msi installer seemed unreliable so I simply got hold of the Ionic.Zip.dll component itself. It can be put in any location on the server, BUT the full path to that location must NOT contain any spaces. C:/MyFolder/Zip/Ionic.Zip.dll
is OK, C:/My Folder/Zip/Ionic.Zip.dll is NOT. It's something the gacutil component doesn't like for some reason.
Second - configuration. You must have the .Net 2.0 SDK installed (and on this server it's the 64 bit version). The method that I found worked was to use the Command Prompt window and navigate (using the cd command) to the directory containing the gacutil.exe
file. The full command is cd C:\Program Files\Microsoft.NET\SDK\v2.0 x64\Bin\ . From here execute the command on the Ionic.Zip.dll by entering gacutil.exe /i <full path to Ionic.zip.dll> In this example the full line would be gacutil.exe /i C:/My
Folder/Zip/Ionic.Zip.dll. You should get a success message. Do exactly the same to register the component with RegAsm. Once done, do NOT move the Ionic.zip.dll file or you'll have to go through this whole process again.
Third - usage. The documentation for using this component with classic ASP is very thin and you need to dig through the reference section and have some understanding of C# or VB.Net to work out the finer points of how all the methods can be used and the
examples given are not altogether helpful.
To zip a number of files in a target directory and save them as a zip to another directory, this is what worked for me:
FileName="C:\MyFolder\ZippedFile" '''The directory that will receive the finished zip file
PicsToZip="C:\MyFolder\PicsToZip" ''The directory that contains pics to be zipped, i.e. MyPic1.jpg, etc
Set Zip = CreateObject("Ionic.Zip.ZipFile")
For jj = 0 to UBound(arrPics)
Points to note here are that:
a) To add a file for zipping I found that the second overloaded method of AddFile was the only that would put the pics where I wanted them. As overloads don't work directly in COM mode, I had to use the 'mangled' description of the name (AddFile_2) which
contains two arguments. By reference to the reference section I discovered these were string, string, the first being the file name, the second being the subdirectory in which they were placed. By setting this to "" pics were placed at the root level
of the zip file. For some reason, if I used simply AddFile, the component created a set of sub directories corresponding to the file path.
b) Calling a method with two arguments in classic ASP is not like the documentation suggests. AddFile_2("FileName","DirectoryName") does not work. It has to be: AddFile_2 "FileName","DirectoryName" with no brackets.
Because my main purpose was to simply create a zip file I haven't investigated the rest of DotNetZip's functionality, but I think these pointers should be helpful - especially if somone can go through the whole of the methods and create a full classic ASP