Need help with Ionic.Zip

Oct 1, 2014 at 7:48 PM
Edited Oct 1, 2014 at 8:31 PM
I just started to use this ionic.zip.dll to create zip files which user can download.
My problem is after click the "download" button, nothing happens. I set break point and checked, seems the zip file has the files added, but somehow nothing happens. I tried in firefox and ie, neither one works.
I then added a try catch block and got this error message:
Message = Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
The Error occurs after Response.End(); so I have no clue what caused it.
please see my code below:

ZipFile zip = new ZipFile();
        for (int i = 0; i < lbxlist.Items.Count; i++)
        {
            if (lbxlist.Items[i].Selected)
            { 
                List<string> paths = getScannedFormPath(lbxlist.Items[i].Value, Convert.ToInt32(cbyear.SelectedValue));
                for (int j = 0; j < paths.Count; j++)
                {
                    string s = paths[j].ToString();

                    if (!zip.ContainsEntry(paths[j].ToString()))
                    {

                        zip.AddFile(paths[j].ToString());
                    }
                }
            }
        }

        Response.Clear();
        Response.AddHeader("Content-Disposition", "attachment; filename=forms.zip");
        Response.ContentType = "application/zip";
        zip.Save(Response.OutputStream);
        Response.End();
Oct 1, 2014 at 8:33 PM
I changed the Response.End() to Response.Close(); and now I do not get the error message. But the zip file is still not showing up or being downloaded. Any ideas?