this is my code
private void sendToClient(Dictionary<string, string> 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();
}
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.
What I get is a zipfile named filename.zip(expected) with a document readme.txt(expected) with no text inside of the doucment(unexpected).
This code is almost verbatim from the example here. Which makes me thing other people have run into this exact problem.
My end goal is to do something like this.
private void sendToClient(Dictionary<string, string> 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();
}
add three strings as files to the zip file, but I'll settle for getting the example working for now.
Anyone have any suggestions?
Thanks
--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.