Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>That did fix the one problem I'm having, but the downloads are still not downloading from the right place, the program still wants to get the files from "C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\" directory here is the code I'm using</p> <p>--Code to populate the checkbox--</p> <pre><code>HttpRequest request = HttpContext.Current.Request; // get the physical path to the web application string appPath = request.MapPath(request.ApplicationPath); string directory = System.IO.Path.Combine(appPath, "DownloadLibrary/"); // Get the list of files into the CheckBoxList var dirInfo = new DirectoryInfo(directory); cblFiles.DataSource = dirInfo.GetFiles(); cblFiles.DataBind();</code></pre> <p>--Download Button Code-- <pre><code>// Tell the browser we're sending a ZIP file! var downloadFileName = string.Format("Items-{0}.zip", DateTime.Now.ToString("yyyy-MM-dd-HH_mm_ss")); Response.ContentType = "application/zip"; Response.AddHeader("Content-Disposition", "filename=" + downloadFileName);</p> // Zip the contents of the selected files using (var zip = new ZipFile()) { // Add the password protection, if specified /*if (!string.IsNullOrEmpty(txtZIPPassword.Text)) { zip.Password = txtZIPPassword.Text; // 'This encryption is weak! Please see http://cheeso.members.winisp.net/DotNetZipHelp/html/24077057-63cb-ac7e-6be5-697fe9ce37d6.htm for more details zip.Encryption = EncryptionAlgorithm.WinZipAes128; }*/ // Construct the contents of the README.txt file that will be included in this ZIP var readMeMessage = string.Format("Your ZIP file {0} contains the following files:{1}{1}", downloadFileName, Environment.NewLine); // Add the checked files to the ZIP foreach (ListItem li in cblFiles.Items) if (li.Selected) { // Record the file that was included in readMeMessage readMeMessage += string.Concat("\t* ", li.Text, Environment.NewLine); // Now add the file to the ZIP (use a value of "" as the second parameter to put the files in the "root" folder) zip.AddFile(li.Value, "Your Files"); } // Add the README.txt file to the ZIP //zip.AddEntry("README.txt", readMeMessage, Encoding.ASCII); // Send the contents of the ZIP back to the output stream zip.Save(Response.OutputStream);&lt;/pre&gt;&lt;/code&gt; </code></pre> <p>I'm not sure how to get the downloads to point to my application directory,I tried everything I can think off.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload