I have a page that generates data. After the data is generated a page is created that lists all the different files that were generated. There are usually 8-12 files. Instead of having my users right-click and save each file I wanted to do it with a button where when the users clicks the button all the files would save to the default browser download location. Within gmail in chrome when I have an attachment and I click download it automatically goes to my download directory. I have to make this work across multiple browsers so if this isn't an option across browsers what would be recommended for the situation I'm in?
Here is the code I have so far:
protected void btnDownloadFile_Click(object sender, EventArgs e)
{
Download_File("X:\\dnloads\\J2207.sas");
Download_File("X:\\dnloads\\J2207.txt");
Download_File("X:\\dnloads\\J2207_codebook.pdf");
}
private void Download_File(string FilePath)
{
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(FilePath));
Response.WriteFile(FilePath);
Response.End();
}
The problem is once it hits Response.End(); it stops and doesn't go to the next file. Is this an incorrect approach or what can I do to have multiple files downloaded?
This is part of a C#/ASP.NET web site.
Thank you