This project is read-only.

Issue after writing zipped file to server

Dec 21, 2010 at 11:02 PM

I am using the following code to zip selected files to the server.  Everything works fine with IE.  With Firefox the file is saved on the server but a bunch of gibberish is written out to the screen.  By the way nothing is actually caught as an exception

Code Used:


                Using zip As New ZipFile()
                    ' filesToInclude is a string[] or List<String>
                    zip.AddFiles(filesToInclude, "")
                    zip.Save(Server.MapPath("invoiceimages/" & archiveName))
		    'i've actually tried a variety of changes below with no success
                    Response.Buffer = False

                    lblMessage.Text = "Invoice images successfully zipped..."
                    rbNext.Enabled = True
                    rbPrev.Enabled = True
                End Using
            Catch ex As Exception
                ErrorMessage.InnerHtml = ex.Message
                ErrorMessage.Visible = True
                lblMessage.Text = ex.Message
                Exit Sub
            End Try


Dec 21, 2010 at 11:37 PM

Hi Carlos,

It's not totally clear what your issue is - could you provide a bit more context? If you're only saving the zip file to the server and not downloading it to the client then the Response.Clear might be doing more harm than good within the normal ASP.NET page lifecycle. On the other hand, if you're trying to send the file to the browser then your "bunch of gibberish" could actually be the binary contents of the zip file rendered inline in the web page. Some more code and / or screenshots would help.



Dec 22, 2010 at 12:02 AM
I'm not sending the file to browser. The zip file is composed of jpegs.

I only added the response code to try and find a solution.

I will post a screen shot when I get in front of pc

Dec 22, 2010 at 2:55 AM

This is what is written to screen immediately after the zip selected files button is clicked and the above code is executed.  I'm not sure if this makes a difference but I am using telerik rad controls for various pieces of the page (but not the zip selected files button).


Dec 22, 2010 at 2:40 PM

Yipes! It looks like a mangled *.aspx page source.

Could you try a couple of other things:

+ Comment out the DotNetZip code in your page and see whether you get the same results or not. Maybe also remove the reference to Ionic.*.dll just to make sure. If the problem persists then it might be something in your ASP.NET install.

+ Run the existing page in IE and Firefox with Fiddler2 running in the background and see if the garbled text is part of the raw http conversation in both cases. (If you're running the site on your local machine you'll need to use http://<machine_name> instead of http://localhost - see for more info).

Dec 22, 2010 at 8:26 PM

Looks like this piece of code was the culprit:


Response.BufferOutput = False

I think this was included in the sample I used but it’s not needed here since I’m not performing a user prompt save dialog. Once I commented out the code ran as expected in IE and Firefox

Carlos Gonzalez

Dec 23, 2010 at 12:10 AM

Fab. Glad you managed to solve it.

Have a great holiday this weekend.