Note that there are some explanatory texts on larger screens.

plurals
  1. POSending Zip file to Client via Response with DotNetZip
    text
    copied!<p>this is my code</p> <pre><code> private void sendToClient(Dictionary&lt;string, string&gt; reportDic) { Response.Clear(); Response.BufferOutput = false; String ReadmeText = "some text"; Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "filename=" + "filename.zip"); using (ZipFile zip = new ZipFile()) { zip.AddEntry("Readme.txt", ReadmeText); zip.Save(Response.OutputStream); } Response.Close(); } </code></pre> <p>at this point I'm simply trying to return a zip file with the readme.txt document inside the zip with the words "some text" inside the document. </p> <p>What I get is a zipfile named filename.zip(expected) with a document readme.txt(expected) with no text inside of the doucment(unexpected). </p> <p>This code is almost verbatim from the example <a href="http://dotnetzip.codeplex.com/Wiki/View.aspx?title=Examples" rel="nofollow noreferrer">here</a>. Which makes me thing other people have run into this exact problem. </p> <p>My end goal is to do something like this. </p> <pre><code> private void sendToClient(Dictionary&lt;string, string&gt; reportDic) { Response.BufferOutput = false; Response.ContentType = "application/zip"; Response.AddHeader("content-dispostion", "filename=text.zip"); Response.ContentEncoding = Encoding.Default; Response.Charset = ""; using (ZipFile zip = new ZipFile()) { foreach (string key in reportDic.Keys) { zip.AddEntry(key, reportDic[key]); } zip.Save(Response.OutputStream); } Response.Close(); } </code></pre> <p>add three strings as files to the zip file, but I'll settle for getting the example working for now. </p> <p>Anyone have any suggestions? </p> <p>Thanks</p> <p>--UPDATE-- This should work, in fact if I copy it into a new project, it works just as advertised, I must have a toxic mix of dlls or some corruption in my project, that is obscure or something. Wonderful. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload