C
Carlo
I am trying to seek the following functionality:
A user clicks on a download buton
I can automatically download a file, but since in the end i must end the
response, its either the download or the page display.
To dowload the file i am using the following code:
Response.ContentType = "application\\octet-stream";
string filename = BaseComponents.GetDownloadLink(productRef);
System.IO.FileStream downloadFile = new System.IO.FileStream(filename,
System.IO.FileMode.Open);
Response.AddHeader("Content-Disposition", "attachment; filename=" +
downloadFile.Name);
Response.AddHeader("Content-Length", downloadFile.Length.ToString());
Response.Write(downloadFile.Length + "#");
downloadFile.Close();
Response.WriteFile(filename);
Response.Flush();
Response.End();
A user clicks on a download buton
he is redirected to another page
download automatically begins while in page.
I can automatically download a file, but since in the end i must end the
response, its either the download or the page display.
To dowload the file i am using the following code:
Response.ContentType = "application\\octet-stream";
string filename = BaseComponents.GetDownloadLink(productRef);
System.IO.FileStream downloadFile = new System.IO.FileStream(filename,
System.IO.FileMode.Open);
Response.AddHeader("Content-Disposition", "attachment; filename=" +
downloadFile.Name);
Response.AddHeader("Content-Length", downloadFile.Length.ToString());
Response.Write(downloadFile.Length + "#");
downloadFile.Close();
Response.WriteFile(filename);
Response.Flush();
Response.End();