Downloadable Zip from stream. Not getting download prompt.

Jul 30, 2009 at 1:52 PM
Edited Jul 30, 2009 at 4:03 PM

First off, thank you for the great library, simplified my life greatly.

I am running into an issue when using a lightly modififed "Create a downloadable zip" sample.  My issue is that I'm not getting a download prompt at all.  What happens is that the stream seems to create the zip just fine, with the files/etc, but then it automatically dumps it into my browser's temporary cache folder and opens it from there in a regular explorer window, showing the contents of the zip.

Not sure why its not asking me where I want to save it with a regular download prompt.

EDIT: Ok, just tried it in Firefox, and it works properly there.  The issue seems to be on the IE8 side.... still, I need that side to work properly as well...

I am using the 'reduced' dll (Ionic.Zip.Reduced.dll) since i only want the very basic of functionality here.

Here's what I have:

protected void DoZip(CheckBoxList cbl, String s)
        Response.BufferOutput = false;  // for large files
        String ReadmeText = ".....";
        string filename = "AEA13ATResource-" + s + ".zip";
        Response.ContentType = "application/zip";
        Response.AddHeader("content-disposition", "filename=" + filename);

        using (ZipFile zip = new ZipFile())
            zip.AddEntry("Readme.txt", "", ReadmeText);
            foreach (ListItem li in cbl.Items)
                if (li.Selected)
                    String file = Server.MapPath("/net/ATResources/files/" + s + "/" + li.Value);
                    zip.AddFile(file, "files");


has to be something simple right?  any help would be greatly appreciated, thank you.


Jul 30, 2009 at 4:00 PM

andy, try replacing the Response.AddHeader call above with this:

    Response.AddHeader("content-disposition", "attachment; filename=" + filename);
Jul 30, 2009 at 4:04 PM

perfection! THANK YOU.

i searched around through the posts, but didn't find anything, although i have a feeling this has been asked already, in which case, apologies for wasting your time answering it again.

Dec 5, 2009 at 12:03 PM

also, I think you should use Response.Close() instead of HttpContext.Current.ApplicationInstance.CompleteRequest();