SHARE
TWEET

ZipDownload

a guest Aug 13th, 2013 33 Never
  1. protected void ZipDownload()
  2. {
  3.   var zip = new ZipFile(@"C:\Users\(myuser)\Desktop\desktop.zip");
  4.  
  5.   Response.Clear();
  6.   Response.AddHeader("content-disposition", "attachment;filename=docs.zip ");
  7.   Response.ContentType = "application/zip";
  8.  
  9.   using (var memoryStream = new MemoryStream())
  10.   {
  11.     zip.Save(memoryStream);
  12.     Response.BinaryWrite(memoryStream.ToArray());
  13.   }
  14.  
  15.   Response.End();
  16. }
RAW Paste Data
Top