title: Download file is corrupted asp.net
body: <p>In my asp.net webpage, I have one <code>Grid</code> and a download <code>Button</code>. The <code>Grid</code> fill the information about the files from a shared location and download button downloads all the files after zipping. </p>
  
  <p>I'm using <code>Ionic.Zip</code> library for zipping. </p>
  
  <p>The below is the code, which executes when the user clicks on the download button.
  The download works fine, but when I bind the files information (like name etc.) to the <code>GridView</code> control it breaks after binding the file information to the <code>GridView</code> control. </p>
  
  <p>I get an error "The compressed zip folder is invalid", but when I save the zip file using the <code>Ionic.Zip</code> library it is not corrupted and I can open it manually!    </p>
  
  <pre><code>HttpContext.Current.Response.Clear();
  Response.ClearContent();Response.Clear();string LogPath = ConfigurationManager.AppSettings["LogPath"];
  LogPath = Path.Combine(LogPath, Application);
  //Zip File will be created when one of the file is in use during Zip.
  ZipFile Zip = new ZipFile();
  Zip.AddDirectory(LogPath);
  string _DateTime = System.DateTime.Now.ToString("ddMMyyHHmmssfff");
  string ZipFileName = string.Format("ZipFile{0}.zip",_DateTime);
  //Zip.Save(Response.OutputStream);
  ErrorMessage.Text = Response.OutputStream.CanRead + " " + Response.OutputStream.CanWrite;
  string _Path = MapPath(".");
  _Path = Path.Combine(_Path, ZipFileName);
  ErrorMessage.Visible = true;
  Zip.Save(_Path);
  // Response.AppendHeader("content-disposition", "filename=" + ZipFileName);
  Response.AppendHeader("content-disposition", "attachment; filename=" + ZipFileName);
  //Response.ContentType = "application/zip";
  Response.ContentType = "application/unknown";
  Response.WriteFile(_Path);
  </code></pre>