[
  {
    "Id": "662857",
    "ThreadId": "270266",
    "Html": "\r\n<p><span>After I create the zip file using this code.</span><br>\r\n<br>\r\n</p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">Using</span> zip = <span style=\"color:blue\">New</span> ZipFile()\r\n\r\n<span style=\"color:blue\">For</span> <span style=\"color:blue\">Each</span> row <span style=\"color:blue\">As</span> GridDataItem <span style=\"color:blue\">In</span> RadGridDocs.MasterTableView.Items\r\n\r\n<span style=\"color:blue\">Dim</span> clientSelectColumn <span style=\"color:blue\">As</span> CheckBox = <span style=\"color:blue\">DirectCast</span>(row(<span style=\"color:#a31515\">&quot;ClientSelectColumn&quot;</span>).Controls(0), CheckBox)\r\n\r\n<span style=\"color:blue\">Dim</span> chkBox = clientSelectColumn.Checked\r\n\r\n<span style=\"color:blue\">If</span> chkBox = <span style=\"color:#a31515\">&quot;True&quot;</span> <span style=\"color:blue\">Then</span>\r\n\r\n<span style=\"color:blue\">Dim</span> txtDocument <span style=\"color:blue\">As</span> TextBox = row.FindControl(<span style=\"color:#a31515\">&quot;txtDocumentFileName&quot;</span>)\r\n<span style=\"color:blue\">Dim</span> fileName <span style=\"color:blue\">As</span> <span style=\"color:blue\">String</span> = txtDocument.Text\r\n\r\n<span style=\"color:blue\">Dim</span> txtDocumentPath <span style=\"color:blue\">As</span> TextBox = row.FindControl(<span style=\"color:#a31515\">&quot;txtDocumentPath&quot;</span>)\r\n<span style=\"color:blue\">Dim</span> documentPath <span style=\"color:blue\">As</span> <span style=\"color:blue\">String</span> = txtDocumentPath.Text\r\n\r\n<span style=\"color:blue\">Dim</span> fullpath <span style=\"color:blue\">As</span> <span style=\"color:blue\">String</span> = Server.MapPath(<span style=\"color:#a31515\">&quot;~&quot;</span>) &#43; <span style=\"color:#a31515\">&quot;\\&quot;</span> &#43; documentPath &#43; fileName\r\n\r\nfullpath = Replace(fullpath, <span style=\"color:#a31515\">&quot;/&quot;</span>, <span style=\"color:#a31515\">&quot;\\&quot;</span>)\r\n\r\nfullpath = Replace(fullpath, <span style=\"color:#a31515\">&quot;\\&quot;</span>, <span style=\"color:#a31515\">&quot;\\\\&quot;</span>)\r\n\r\n<span style=\"color:green\">'Code to Zip a Folder.</span>\r\n\r\nzip.AddFile(fullpath)\r\n\r\n<span style=\"color:blue\">End</span> <span style=\"color:blue\">If</span>\r\n\r\n<span style=\"color:blue\">Next</span>\r\n\r\nzip.Save(Response.OutputStream)\r\n\r\n<span style=\"color:blue\">End</span> <span style=\"color:blue\">Using</span>\r\n</pre>\r\n</div>\r\n<br>\r\n<br>\r\n<span>-----------------------------------</span><span>----------------------------------</span><br>\r\n<br>\r\n<span>I am trying to send this out via a asp.net application using .NET 3.5. I keep getting the error &quot;Cannot open file: it does not appear to be a valid archive.&quot;</span><br>\r\n<br>\r\n<span>Are there any ideas?</span>\r\n<p></p>\r\n",
    "PostedDate": "2011-08-24T12:31:43.853-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "662943",
    "ThreadId": "270266",
    "Html": "<p>That error indicates that the thing you are trying to read is not a valid zip file. Usually this means a truncated file, or a file with extra rubbish in it, after the valid zip bytes. Either is possible with ASPNET.</p>\r\n<p>The most common case in my experience is rubbish after the valid zip data.&nbsp; After you call Zip.Save(Response.OutputStream), you need to call Response.End() in order to terminate the ASPNET response, flush the output stream, and transmit the file and only the zip file, to the browser.&nbsp; did you do that?&nbsp; If your app does not do that, it can result in rubbish in the downloaded (transmitted) zip file.</p>\r\n<p>If you want to look more closely into the problem, you can hook up Fiddler2 to see the HTTP transaction.&nbsp; Or, open the resulting downloaded zipfile itself in an editor that supports editing binary files, like emacs. If you see rubbish HTML codes either in the top of the file or the bottom of the zip file, then you probably have a buffer problem on the Response.OutputStream.&nbsp; You need to clear the buffer and reset the mimetype before writing anything, and call Response.End() after ZipFile.Save(Response.OutputStream) .&nbsp;&nbsp; Complicating matters is that I Released a faulty example a looong time ago that did not call Response.End() as it needed to, and it has been re-used in lots of places. &nbsp;You may have been following a bad example.</p>\r\n<p>The problem is not in the code you are showing above.&nbsp; It is in code that runs before that, or after that.</p>",
    "PostedDate": "2011-08-24T15:04:38.977-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "663197",
    "ThreadId": "270266",
    "Html": "<font size=\"2\" face=\"sans-serif\">Thanks,</font> <br>\r\n<br>\r\n<font size=\"2\" face=\"sans-serif\">That seems to be helping me I really appreciate your help.</font>\r\n<br>\r\n<br>\r\n<font size=\"2\" face=\"sans-serif\">______________________________</font> <br>\r\n<font size=\"2\" face=\"sans-serif\">Thank You,</font> <br>\r\n<br>\r\n<font size=\"2\" face=\"sans-serif\">Charles Hawk</font> <br>\r\n<font size=\"2\" face=\"sans-serif\">IS Specialist</font> <br>\r\n<br>\r\n<font size=\"2\" face=\"sans-serif\">Kawasaki Motors Manufacturing Corp., USA</font> <br>\r\n<font size=\"2\" face=\"sans-serif\">P.O. Box 81469, 6500 N.W. 27th Street</font> <br>\r\n<font size=\"2\" face=\"sans-serif\">Lincoln, NE 68524</font> <br>\r\n<br>\r\n<font size=\"2\" face=\"sans-serif\">Phone: (402) 476-6600 x5357</font> <br>\r\n<font size=\"2\" face=\"sans-serif\">Fax: (402) 476-4372</font> <br>\r\n<br>\r\n<font size=\"2\" face=\"sans-serif\">(This E-mail address is to be used for business purposes only. Do not send any E-mail messages to this address that do not have a specific business purpose. Thank you.)</font>\r\n<br>\r\n<br>\r\n<br>\r\n<br>\r\n<font size=\"1\" color=\"#5f5f5f\" face=\"sans-serif\">From: </font><font size=\"1\" face=\"sans-serif\">&quot;Cheeso&quot; &lt;notifications@codeplex.com&gt;</font>\r\n<br>\r\n<font size=\"1\" color=\"#5f5f5f\" face=\"sans-serif\">To: </font><font size=\"1\" face=\"sans-serif\">chawk@lcn.kmmfg.com</font>\r\n<br>\r\n<font size=\"1\" color=\"#5f5f5f\" face=\"sans-serif\">Date: </font><font size=\"1\" face=\"sans-serif\">08/24/2011 05:04 PM</font>\r\n<br>\r\n<font size=\"1\" color=\"#5f5f5f\" face=\"sans-serif\">Subject: </font><font size=\"1\" face=\"sans-serif\">Re: After creating .zip I get error when opening the file [DotNetZip:270266]</font>\r\n<br>\r\n<hr noshade=\"\">\r\n<br>\r\n<br>\r\n<br>\r\n<font size=\"2\" face=\"Verdana\">From: Cheeso</font>\r\n<p><font size=\"2\" face=\"Verdana\">That error indicates that the thing you are trying to read is not a valid zip file. Usually this means a truncated file, or a file with extra rubbish in it, after the valid zip bytes. Either is possible with ASPNET.</font>\r\n</p>\r\n<p><font size=\"2\" face=\"Verdana\">The most common case in my experience is rubbish after the valid zip data. After you call Zip.Save(Response.OutputStream), you need to call Response.End() in order to terminate the ASPNET response, flush the output stream, and\r\n transmit the file and only the zip file, to the browser. did you do that? If your app does not do that, it can result in rubbish in the downloaded (transmitted) zip file.</font>\r\n</p>\r\n<p><font size=\"2\" face=\"Verdana\">If you want to look more closely into the problem, you can hook up Fiddler2 to see the HTTP transaction. Or, open the resulting downloaded zipfile itself in an editor that supports editing binary files, like emacs. If you see\r\n rubbish HTML codes either in the top of the file or the bottom of the zip file, then you probably have a buffer problem on the Response.OutputStream. You need to clear the buffer and reset the mimetype before writing anything, and call Response.End() after\r\n ZipFile.Save(Response.OutputStream) . Complicating matters is that I Released a faulty example a looong time ago that did not call Response.End() as it needed to, and it has been re-used in lots of places. You may have been following a bad example.</font>\r\n</p>\r\n<p><font size=\"2\" face=\"Verdana\">The problem is not in the code you are showing above. It is in code that runs before that, or after that.</font>\r\n</p>\r\n<p><font size=\"2\" color=\"#808080\" face=\"Verdana\">Read the </font><a href=\"http://dotnetzip.codeplex.com/discussions/270266#post662943\"><font size=\"2\" color=\"blue\" face=\"Verdana\"><u>full discussion online</u></font></a><font size=\"2\" color=\"#808080\" face=\"Verdana\">.</font>\r\n</p>\r\n<p><font size=\"2\" color=\"#808080\" face=\"Verdana\">To add a post to this discussion, reply to this email (</font><a href=\"mailto:DotNetZip@discussions.codeplex.com?subject=[DotNetZip:270266]\"><font size=\"2\" color=\"blue\" face=\"Verdana\"><u>DotNetZip@discussions.codeplex.com</u></font></a><font size=\"2\" color=\"#808080\" face=\"Verdana\">)</font>\r\n</p>\r\n<p><font size=\"2\" color=\"#808080\" face=\"Verdana\">To start a new discussion for this project, email\r\n</font><a href=\"mailto:DotNetZip@discussions.codeplex.com\"><font size=\"2\" color=\"blue\" face=\"Verdana\"><u>DotNetZip@discussions.codeplex.com</u></font></a>\r\n</p>\r\n<p><font size=\"2\" color=\"#808080\" face=\"Verdana\">You are receiving this email because you subscribed to this discussion on CodePlex. You can\r\n</font><a href=\"https://dotnetzip.codeplex.com/discussions/270266/unsubscribe/\"><font size=\"2\" color=\"blue\" face=\"Verdana\"><u>unsubscribe</u></font></a><font size=\"2\" color=\"#808080\" face=\"Verdana\"> on CodePlex.com.</font>\r\n</p>\r\n<p><font size=\"2\" color=\"#808080\" face=\"Verdana\">Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com</font>\r\n<br>\r\n<font size=\"2\" face=\"sans-serif\"><br>\r\n</font></p>\r\n",
    "PostedDate": "2011-08-25T05:59:15.08-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]