[
  {
    "Id": "222954",
    "ThreadId": "65473",
    "Html": "<p>I have managed to work out how to read a zip file in asp (VBScript) but cannot extract because (I think) the Extract method will not accept an argument for the baseDirectory (or anything else).</p>\r\n<p>If I could find a way to set the current directory in ASP that would be cool too but doesn't seem to be a way.</p>\r\n<p>When I try to extract using entry.Extract() I get the message <span style=\"font-style:normal;font-variant:normal;font-weight:normal;font-size:8pt;line-height:11pt\">Ionic.Zip (0x80131500)<br>Cannot extract</span></p>\r\n<p>Any ideas greatly appreciated</p>\r\n<p><span style=\"font-style:normal;font-variant:normal;font-weight:normal;font-size:8pt;line-height:11pt\"><br></span></p>",
    "PostedDate": "2009-08-13T06:45:58.043-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222996",
    "ThreadId": "65473",
    "Html": "<p>To set the current directory, you can use WScript.Shell object and set the CurrentDirectory property. Not sure if this works in ASP. (I'm not an ASP expert).</p>\r\n<p>Why still writing in ASP?&nbsp;&nbsp;&nbsp; Why not write the page in ASP.NET?&nbsp; It would be simpler.&nbsp; anyway here's the VBSCript code.</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">Sub</span> listAndMaybeExtractZip()\r\n\r\n    WScript.echo(<span style=\"color:#A31515\">&quot;&quot;</span>)\r\n    <span style=\"color:Blue\">Dim</span> zip\r\n    WScript.echo(<span style=\"color:#A31515\">&quot;Instantiating another ZipFile object...&quot;</span>)\r\n    <span style=\"color:Blue\">Set</span> zip = CreateObject(<span style=\"color:#A31515\">&quot;Ionic.Zip.ZipFile&quot;</span>)\r\n    \r\n    WScript.echo(<span style=\"color:#A31515\">&quot;Initialize (Read)...&quot;</span>)\r\n    zip.Initialize(filename)\r\n\r\n    <span style=\"color:Blue\">If</span> <span style=\"color:Blue\">Not</span> (extractLocation = <span style=\"color:#A31515\">&quot;&quot;</span>) <span style=\"color:Blue\">Then</span>\r\n        CreateExtractDirectory(extractLocation)\r\n\r\n        <span style=\"color:Blue\">Set</span> objShell = CreateObject(<span style=\"color:#A31515\">&quot;Wscript.Shell&quot;</span>)\r\n        objShell.CurrentDirectory = extractLocation\r\n        WScript.echo(<span style=\"color:#A31515\">&quot;listing and extracting entries...&quot;</span>)\r\n    <span style=\"color:Blue\">else</span>\r\n        WScript.echo(<span style=\"color:#A31515\">&quot;listing entries...&quot;</span>)\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n\r\n    <span style=\"color:Blue\">For</span> <span style=\"color:Blue\">Each</span> entry <span style=\"color:Blue\">in</span> zip\r\n        WScript.echo(<span style=\"color:#A31515\">&quot;  &quot;</span> &amp; entry.FileName)\r\n\r\n        <span style=\"color:Blue\">If</span> <span style=\"color:Blue\">Not</span> (extractLocation = <span style=\"color:#A31515\">&quot;&quot;</span>) <span style=\"color:Blue\">Then</span>\r\n            ext = Right(entry.FileName,4)\r\n            <span style=\"color:Blue\">If</span> (ext = <span style=\"color:#A31515\">&quot;.vbs&quot;</span>) <span style=\"color:Blue\">Then</span>\r\n                <span style=\"color:Blue\">If</span> <span style=\"color:Blue\">Not</span> (password = <span style=\"color:#A31515\">&quot;&quot;</span>) <span style=\"color:Blue\">Then</span>\r\n                    entry.Password = password\r\n                <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n                <span style=\"color:Green\">' extract into current directory</span>\r\n                entry.Extract()\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n    <span style=\"color:Blue\">Next</span>\r\n\r\n    WScript.echo(<span style=\"color:#A31515\">&quot;Disposing...&quot;</span>)\r\n    zip.Dispose()\r\n\r\n    WScript.echo(<span style=\"color:#A31515\">&quot;Done.&quot;</span>)\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n</pre>\r\n</div>",
    "PostedDate": "2009-08-13T08:31:44.3-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223170",
    "ThreadId": "65473",
    "Html": "<p>Yeah there are probably good reasons to go to ASP.NET but to be honest I don't even know where to start and it is not my core business, so was hoping for a quick solution.</p>\r\n<p>I have used the sample code you supply as the base but as I mentioned the entry.Extract method wants to put the file in the current directory and there is no way that I know of in ASP to set the default directory. I have tried using entry.Extract(baseDirectory) but I'm guessing that is not available in the COM implementation because I get invalid argument errors.</p>\r\n<p>I can't find a reference for the error number so I am only making these assumptions based on other tests.</p>\r\n<p>Thanks</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-13T16:42:11.483-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223209",
    "ThreadId": "65473",
    "Html": "<p>error 0x80131500&nbsp; translates to &quot;unknown error&quot;.&nbsp; It really isn't unknown, though. The problem with caling Extract() from COM is that there are multiple overloads of the Extract() method, and there is no way to determine which overload you are asking for, by parameter type alone.</p>\r\n<p>If you don't mind extracting all the files, you can call ZipFile.ExtractAll().&nbsp; There's also an overload that lets you specify the path to extract to.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-13T19:20:12.68-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223231",
    "ThreadId": "65473",
    "Html": "<p>Thanks Cheeso. That works.</p>\r\n<p>ZipFile.ExtractAll(targetDirectory)</p>\r\n<p>It seems that the methods require 1 and only 1 parameter. If I try to use the <span>extractExistingFile parameter it fails. Which means clearing the target Directory before each run. Not a problem really.<br></span></p>\r\n<p><span>I would love to be able to use the </span><span>ExtractSelectedEntries method as I only need to extract one file from each archive but that would require using at least 3 parameters (to set the targetDirectory) and it fails. Is it possible to pass more than one parameter some how, or some other workaround.</span></p>\r\n<p><span>But in the meantime I am up and going. Thanks again.<br></span></p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-13T20:30:12.71-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223261",
    "ThreadId": "65473",
    "Html": "<p>Calling the Extractall() method with the extractExistingFile param, runs into the same problem.&nbsp; There's an overload with the same number of parameters.&nbsp; That happened for lots of members, when I modified the design.&nbsp; See, originally there was a boolean true/false value for the overwrite parameter.&nbsp; If you passed false, it would throw an exception if there was an existing file.&nbsp; If you passed true, it would overwrite an existing file.&nbsp; There was no way to tell the library to NOT overwrite an existing file and also not throw an exception.&nbsp; So I created new methods, that accepted an enum parameter instead of a boolean.&nbsp; The enum allows more control over what to do with existing files.</p>\r\n<p>But, I couldn't remove the old members because that would cause older apps to fail to compile. So all the new methods (with the enum) have the same number of parameters as the older methods (with the boolean), and because of that, COM cannot call those methods.&nbsp; Well, not by their regular name anyway.</p>\r\n<p>But&nbsp;this is worth trying::&nbsp; when .NET dynamically builds&nbsp;type libraries COM-callable wrappers, it&nbsp;appends&nbsp; _2, _3, and so on, to overloaded methods.&nbsp;</p>\r\n<p>So, can you try:</p>\r\n<pre>  Dim OverwriteSilently\r\n  OverwriteSilently = 1\r\n  zip.ExtractSelectedEntries_5&nbsp; &quot;name = TheFileYouWant.txt&quot;, Null, extractLocation, OverwriteSilently\r\n</pre>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-13T23:39:05.193-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223440",
    "ThreadId": "65473",
    "Html": "<p>That's awesome. A little bit of testing and it's up and going.</p>\r\n<p>Now that I know that trick I should be able to work around most issues (after guessing what the serial no for the overload method  is)</p>\r\n<p>I notice that ExtractAll creates the extractLocation folder if it doesn't exist where ExtractSelectedEntries doesn't. Not a problem just an observation.</p>\r\n<p>And it is really quick I need to extract 1 file from many archives. I just ran a test through that took about a minute to extract files from 2350 archives and involved copying them and renaming, Brilliant!</p>\r\n<p>The last thing I noticed and this may be normal, but I had to destroy the object (Set objZip = Nothing) and recreate it each time before using a new archive or I got errors (not a valid zip file) after 2 iterations. I am using objZip.Dispose() but that just gets me one more iteration before it errors.</p>\r\n<p>I'm thinking there maybe a lot of happy Classic ASP'ers out there when they find this can work for them.</p>",
    "PostedDate": "2009-08-14T04:38:02.403-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223451",
    "ThreadId": "65473",
    "Html": "<p>Sounds like some good tips there.&nbsp; I'll modify the documentation for COM users on those things...</p>\r\n<p>Glad its working for you.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-14T05:25:55.397-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223903",
    "ThreadId": "65473",
    "Html": "<p>Hey, Cheeso - firstly thanks for a great library, i love it. And your support (i've been reading the discussions) is nothing short of outstanding.</p>\r\n<p>As this thread was chatting about COM Interop&nbsp;i was thinking how i can use the information in this thread.&nbsp; I use Vba quite a bit and&nbsp;still use&nbsp;VbScript\\asp - It would be great if you could make the the type libraries generated from TLBEXP.EXE show the mehods&nbsp;. So we could use this library in VBA projects, I'm thinking Access and Excel with itellisense.&nbsp; You can't add the dll currently as a reference, you can add the typelibrary (haven't tried using it as the public methods aren't shown on the classes. The intelisence may help with your overloaded method suggestion above.</p>\r\n<p>I'm no expert or have no idea about the implications of doing this but it looks like every public methods need to implement an Interface and each public class implements the attribute ClassInterface(ClassInterfaceType.None)] - well thats what i was reading here <a href=\"http://www.15seconds.com/issue/040722.htm\">http://www.15seconds.com/issue/040722.htm</a></p>\r\n<p>Perhaps a future/dedicated version - a lot of apps get written in Access and&nbsp;Excel especially&nbsp;Excel as departmental automation tools, that go way&nbsp;beyond the applications purpose. They provide such a convienient well known interface, and everyones got&nbsp;them installed.&nbsp;</p>\r\n<p>Anyway as i say i'm no expert,&nbsp;the idea&nbsp;may have implications on your design that you do not want to go down</p>\r\n<p>Matt</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-15T13:12:36.827-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223927",
    "ThreadId": "65473",
    "Html": "<p>Hey Matt,</p>\r\n<p>It's a good idea.&nbsp; The right thing to do.&nbsp; There are a couple of reasons why I haven't done that.&nbsp;</p>\r\n<p>First, I'm lazy.&nbsp; Second, no one has really asked for the typelib, until you.&nbsp;&nbsp; Third, I don't really want to test it (which is really just another way of saying, &quot;I'm lazy.&quot;)</p>\r\n<p>But I will make it an official workitem.&nbsp; And we'll see how much interest we get!</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-15T15:32:19.25-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223928",
    "ThreadId": "65473",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/WorkItem/View.aspx?WorkItemId=8515\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2009-08-15T15:32:56.33-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]