This project is read-only.

Error after downloading with Firefox 3.6

Mar 17, 2010 at 11:43 AM


I've tested the dotnetzip utility in a web application of mine, but experience problems with Firefox 3.6.
After I've downloaded a zipfile successfully and then navigate I get a strange error:

XML-lesefeil: ikke velformet
Plassering: http://localhost/blkdb/templates/Pages/DownloadForms.aspx

Linjenummer 1, kolonne 3274:0Z5FgPexNF4xXs8OPhusBuB1gYy" />

It says xml read error, not well formed,  linenumber, column and the error is indicated on the quotation mark.
The error seems to have something to do with the viewstate value.
Other times it indicates slash at the start of the viewstate value.

After generating the zip file I have code for downloading the file. Goes like this:

        public static void DownloadForm(string formfile, String filename)
            byte[] byteArray = File.ReadAllBytes(formfile);
            HttpContext.Current.Response.ContentType = "application/zip";
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
            HttpContext.Current.Response.AddHeader("content-length", byteArray.Length.ToString());









 It works okey in IE, but not in Firefox.

Anybody who as any ideas? In advance thanks for your reply!

Kind regards,

Jon Haakon



Mar 17, 2010 at 2:03 PM

if I were you I would attach an http debugger to the page, to see what is being received by firefox.  Fiddler is a good one.

It could be that the page, defined in .aspx, is not effectively changing its content type for firefox, for some reason.  

Independently of what you learn from Fiddler, You may wish to try some of these things to avoid the problem:

  • Insert a Response.Close() after Response.BinaryWrite()
  • Put the code that generates and downloads the .zip file into a .ashx (HttpHandler) module
  • move to ASPNET MVC, and configure this code as an Action on a Controller.

None of these things have anything to do with DotNetZip.  You're simply downloading some binary content into a browser.  That the content was originally from DotNetZip is sort of tangential to the main plot.  So if these suggestions don't help, I'd suggest trying a more generat forum for web development - they may have better ideas.

Good luck.

Mar 17, 2010 at 3:04 PM


Thanks for the reply!

I seems like the "Response.End()" did it. :)

I had previously used "Response.Close()", but that gave an error. "End" works better.

Fiddler reported :

Fiddler has detected a protocol violation in session #5. Content-Length mismatch: Response Header claimed xxxxx bytes, but server sent xxxx  bytes. 

Kind regards,

Jon Haakon

Mar 17, 2010 at 3:57 PM

Well, I thought it fixed the problem however, it generates an error that my application ignores.

In debug I get a compilererror:

Thread aborted.

"Message = Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."


Jon Haakon

Mar 17, 2010 at 6:56 PM

Response.End() will abort the thread.  Always.

It's why I suggest Response.Close(). 

Not sure about that content-length mismatch though. That bears further investigation.

You may want to try including a

    Response.BufferOutput= false;

just after calling Response.Clear().