Zip Content Type in a Response with Firefox And Chrome

8Curious8

New Member
I'm writing an application for Sharepoint that implements a button on a ribbon to download multiple files as a zip...Everything goes fine, everything goes well... But when I tried to download the zip with with Chrome or Firefox they do nothing..My code is this:\[code\]private void WriteStreamToResponse(MemoryStream ms) { if (ms.Length > 0) { string filename = DateTime.Now.ToFileTime().ToString() + ".zip"; Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.ContentType = "application/zip"; //also tried application/octect and application/x-zip-compressed Response.AddHeader("Content-Length", ms.Length.ToString()); Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); byte[] buffer = new byte[65536]; ms.Position = 0; int num; do { num = ms.Read(buffer, 0, buffer.Length); Response.OutputStream.Write(buffer, 0, num); } while (num > 0); Response.Flush(); } }\[/code\]
 
Top