[
  {
    "Id": "592967",
    "ThreadId": "252811",
    "Html": "\r\n<p>I'm working on some code that I want to run on our web server to allow users to delete PDF documents from our online library of articles.&nbsp; So I thought before deleting the selected files, it would be a good up to zip them up and send them to the user.&nbsp;\r\n The following code works great when I'm dealing with small number of files (~100).&nbsp; But when I tried with a few thousand for testing reasons, I just get 56 byte file that is obviously not right.&nbsp; I'm not sure what's wrong here, but I'm sure someone\r\n can show me what I'm doing wrong.</p>\r\n<p>&nbsp;</p>\r\n<p></p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre>Response.Clear();\r\nResponse.BufferOutput = <span style=\"color:blue\">false</span>;\r\n\r\nSystem.Web.HttpContext c = System.Web.HttpContext.Current;\r\n\r\n<span style=\"color:blue\">var</span> downloadFileName = <span style=\"color:blue\">string</span>.Format(<span style=\"color:#a31515\">&quot;LitRackBackup-{0}.zip&quot;</span>, DateTime.Now.ToString(<span style=\"color:#a31515\">&quot;yyyy-MM-dd-HH_mm_ss&quot;</span>));\r\nResponse.ContentType = <span style=\"color:#a31515\">&quot;application/zip&quot;</span>;\r\nResponse.AddHeader(<span style=\"color:#a31515\">&quot;Content-Disposition&quot;</span>, <span style=\"color:#a31515\">&quot;filename=&quot;</span> &#43; downloadFileName);\r\n\r\n<span style=\"color:blue\">using</span> (<span style=\"color:blue\">var</span> zip = <span style=\"color:blue\">new</span> ZipFile())\r\n{\r\n    <span style=\"color:blue\">foreach</span> (MissingDoc deleteDoc <span style=\"color:blue\">in</span> deleteDocs)\r\n        zip.AddFile(deleteDoc.FullFilename);\r\n\r\n    zip.Save(Response.OutputStream);\r\n}\r\n\r\nResponse.Close();\r\n</pre>\r\n</div>\r\n<p></p>\r\n",
    "PostedDate": "2011-04-06T10:57:58.047-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "593074",
    "ThreadId": "252811",
    "Html": "<p>Hmm, your code looks fine. Not sure why you'd see the behavior you are seeing. You might want to explore where the boundary is - where does it stop working and start failing?&nbsp; At what number of files, or at what size download?</p>\r\n<p>There <em>were </em>some problems with large downloads from IE. I can't find the article now that describes the problem.&nbsp; This was an IE problem not a server issue. If this were what you were seeing, then you should be able to succeed downloading using Firefox, or some automated HTTP client (like a .NET app using System.Net.HttpClient or whatever the namespace is).</p>\r\n<p>If you have your app hosted by a service provider, they may have a max download size limit set for your app.&nbsp; I don't know how to set this in IIS but I'm pretty sure it can be done.&nbsp; Maybe check that.</p>\r\n<p>Also - depending on the client, sometimes the streamed downloads don't work properly. Mac browsers can download, but then the zip utility builtin to MacOS cannot open the streamed zip.&nbsp; This has been discussed before here on the forums, maybe search the archives ifyou wanna learn more. The way to avoid this problem is to write the file to a temporary location on the server, then download the file after you've saved it, then later clean up (delete) the temporary file from the server.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2011-04-06T13:10:28.493-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "593083",
    "ThreadId": "252811",
    "Html": "<p>Thanks for the feedback.&nbsp; I'll check out the boundaries and see if I can narrow it down.</p>\r\n<p>As for large downloads, I'm not sure what the size is, but it shouldn't be larger than a couple hundred megabytes.&nbsp; The size of the entire repository is 471MB and I'm wanting to zip up about a third of those (PDF files).&nbsp; I just checked and it fails on Firefox also.&nbsp; Just the 56 bytes I'm getting on IE.</p>\r\n<p>It's not hosted.&nbsp; Currently it's running locally on my machine for testing.&nbsp; Then it will be moved to our development server.&nbsp; There are no limits set unless they're a default value.&nbsp; Still, I'll move it to the development server to see if that makes a difference.</p>\r\n<p>Don't have to worry about Macs.&nbsp; This is for our local intranet and we're a Microsoft shop.</p>\r\n<p>Thanks for the tip about save the file on the server, then sending it.&nbsp; I'll get it a shot.</p>",
    "PostedDate": "2011-04-06T13:20:30.983-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "597348",
    "ThreadId": "252811",
    "Html": "<p>By the way, I found the problem.&nbsp; It was completely unrelated to my zip code.&nbsp; Due to another bug, I was trying to put the same file in the zip twice.</p>",
    "PostedDate": "2011-04-14T11:22:24.447-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "598247",
    "ThreadId": "252811",
    "Html": "<p>Hmm, glad you found the problem, but ... I think that adding a file twice should fail in a clearer way.</p>",
    "PostedDate": "2011-04-15T15:46:38.753-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "598249",
    "ThreadId": "252811",
    "Html": "<p>That would have been nice.&nbsp; It was throwing an ArgumentException.&nbsp; But for some reason I don't recall off the top of my head, that wasn't stopping my code.&nbsp; It appeared to run fine.&nbsp; It was only stepping through with the debugger that finally opened my eyes. And like I said, it was a bug in the other portion of my code that had nothing to do with zipping.&nbsp; I was building my list of files incorrectly.</p>\r\n<p>&nbsp;</p>\r\n<p>On a completely unrelated note, I was working on this yesterday when I heard someone a couple cubes down raving to someone else about Ionic.Zip!&nbsp; He's using it to unzip files for something unrelated and was just loving it.&nbsp; And it was someone else we work with who showed him.&nbsp; :)</p>",
    "PostedDate": "2011-04-15T15:51:55.427-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "598350",
    "ThreadId": "252811",
    "Html": "<p>Ah, terrific!&nbsp; Glad to hear it!</p>\r\n<p>On the unrelated note - now you know the guy who wrote it.&nbsp; I'm a Steelers fan, and I wrote it because I hated the lack of a workable, rational free zip lib for .NET. Then it just took off and got a life of its own.</p>\r\n<p>Anyway, good luck.</p>",
    "PostedDate": "2011-04-16T02:29:33.197-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "599971",
    "ThreadId": "252811",
    "Html": "<p>Thanks!&nbsp; Nice to meet you too.&nbsp; Though I gotta say I sure hope I don't need to return here anytime soon! ;-)</p>",
    "PostedDate": "2011-04-19T13:17:45.173-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]