[
  {
    "Id": "508944",
    "ThreadId": "231364",
    "Html": "<p>I have a file on our webserver created&nbsp;with &nbsp;AES encryption and would like to extract one file from it to download. I don't know it is possible to not.</p>\r\n<p>Using zip As new ZipFile(FilePath)<br>&nbsp;&nbsp;&nbsp; Dim e As ZipEntry<br>&nbsp;&nbsp;&nbsp; For Each e In zip<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If (e.UsesEncryption)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.ExtractWithPassword(&quot;Secret!&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Extract<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp; Next<br>End Using</p>\r\n<p>I appreciate if any one can help.</p>\r\n<p>Thanks</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-10-18T12:27:44.553-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "508992",
    "ThreadId": "231364",
    "Html": "<p>The sample code that you show, should work to extract all entries from the zipfile into the filesystem.</p>\r\n<p>It sounds to me like you would like to extract a single entry, and you want to do it&nbsp;from code that runs within ASPNET.&nbsp; You then want to download the contents of that entry to the requesting browser.</p>\r\n<p>You first need to select one particular entry.&nbsp; You can do this with ZipFile.SelectEntries, or with the string-based indexer on the ZipFile class.&nbsp; (eg, zip(&quot;EntryName&quot;) ).&nbsp; Then you need to appropriately extract the contents of that entry.&nbsp; You can do this with one of the ZipEntry.Extract overloads that accepts a stream for output,&nbsp;passing in the Response.OutputStream.&nbsp;&nbsp;You can also do it by calling ZipEntry.OpenReader(), manually reading the data, and then writing it to Response.OutputStream (this is sometimes called&nbsp;a &quot;data pump&quot;, a common technique in streams-based IO handling).&nbsp;&nbsp;&nbsp;In either case you will have to employ the logic that tests UsesEncryption, and call the overload with the appropriate password.</p>\r\n<p>Good luck.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-10-18T14:16:43.43-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "509281",
    "ThreadId": "231364",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>I am using windows form (VB.NET). I am trying to download a file from our web server. The zip file contain only one single file. I&nbsp;want to extract it in the memory and then download the actual file from the zip instead of a zipfile itself and as I said before that it is a password protected.</p>\r\n<p>Thanks</p>",
    "PostedDate": "2010-10-19T04:15:05.333-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "511707",
    "ThreadId": "231364",
    "Html": "\r\n<p>ok, no problem.</p>\r\n<p>Start with the code you have above.&nbsp; Modify it to eliminate the FOR loop.&nbsp; You want to extract a single entry, not all of them.&nbsp; So eliminate the loop.&nbsp; Select the entry by name or number, using the indexer on the ZipFile class.&nbsp;\r\n Then call .ExtractWithPassword() on that ZipEntry, and specify&nbsp;the Response.OutputStream for the output stream.&nbsp;</p>\r\n<p><span style=\"text-decoration:line-through\">There are examples in the DotNetZip source that show how to do this.\r\n<a href=\"http://dotnetzip.codeplex.com/SourceControl/changeset/view/65587\">http://dotnetzip.codeplex.com/SourceControl/changeset/view/65587</a></span></p>\r\n<p>I thought there were examples that did this, but apparently that's not true. Even so, it shouldn't be difficult.</p>\r\n",
    "PostedDate": "2010-10-24T06:47:31.29-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]