title: downloaded zip file corrupted
body: <p>I'm using following code to download a zip file</p>
  
  <pre><code>protected void btnDownloadNow_Click(object sender, EventArgs e)
      { if (cblFiles.SelectedItem == null)
          {
  
              RegisterStartupScript("as","You must select one or more files to download.");
  
          }
  
  
          var downloadFileName = string.Format("Transmittal.zip", DateTime.Now.ToString("yyyy-MM-dd-HH_mm_ss"));
          Response.ContentType = "application/zip";
          Response.AddHeader("Content-Disposition", "filename=" + downloadFileName);
  
  
          using (var zip = new ZipFile())
          {
  
              if (!string.IsNullOrEmpty(txtZIPPassword.Text))
              {
                  zip.Password = txtZIPPassword.Text;
  
  
                  zip.Encryption = EncryptionAlgorithm.WinZipAes128;
              }
  
  
              var readMeMessage = string.Format("Your ZIP file {0} contains the following files:{1}{1}", downloadFileName, Environment.NewLine);
  
  
              foreach (ListItem li in cblFiles.Items)
                  if (li.Selected)
                  {
  
                      readMeMessage += string.Concat("\t* ", li.Text, Environment.NewLine);
  
                      zip.AddFile(li.Value, "Your Files");
                  }
  
  
  
              zip.AddEntry("README.txt", readMeMessage, Encoding.ASCII);
  
  
              zip.Save(Response.OutputStream);
  
          }
  </code></pre>
  
  <p>and i have the following javascript on the same page</p>
  
  <pre><code>function CheckAllPDF(value) {
              var elementRef = document.getElementById("&lt;%= cblFiles.ClientID %&gt;");
              var checkBoxArray = elementRef.getElementsByTagName('input');
  
              var checkBoxLabelArray = elementRef.getElementsByTagName('label');
  
              var checkedValues = '';
  
              for (var i = 0; i &lt; checkBoxArray.length; i++) {
  
                  var checkBoxRef = checkBoxArray[i];
                  var checkBoxLabelRef = checkBoxLabelArray[i];
                  var stringt = checkBoxLabelRef.innerHTML;
                  var match = stringt.indexOf(".pdf");
                  if (value == true) {
                      document.getElementById("&lt;%=Checkbox1.ClientID %&gt;").checked = false;
                      document.getElementById("&lt;%=cc.ClientID %&gt;").checked = false;
                      if (match != -1) {
                          checkBoxRef.checked = true;
  
                      }
                      else {
                          checkBoxRef.checked = false;
                      }
                  }
                  else {
                      // checkBoxRef.checked = false;
                      if (match != -1) {
  
                          checkBoxRef.checked = false;
                          document.getElementById("&lt;%=Checkbox1.ClientID %&gt;").checked = false;
                      }
                      else {
                          // checkBoxRef.checked = true;
                      }
                  }
  
              }
          }
  </code></pre>
  
  <p>my issue is the downloaded zip file is corrupted due to above javascript code.when i remove the javascript from the page zip file works fine.why this javascript cause such an error</p>