A user clicks on a download buton
he is redirected to another pageI can automatically download a file, but since in the end i must end the
download automatically begins while in page.
response, its either the download or the page display.
To dowload the file i am using the following code:
Response.Conten tType = "application\\o ctet-stream";
string filename = BaseComponents. GetDownloadLink (productRef);
System.IO.FileS tream downloadFile = new System.IO.FileS tream(filename,
System.IO.FileM ode.Open);
Response.AddHea der("Content-Disposition", "attachment ; filename=" +
downloadFile.Na me);
Response.AddHea der("Content-Length", downloadFile.Le ngth.ToString() );
Response.Write( downloadFile.Le ngth + "#");
downloadFile.Cl ose();
Response.WriteF ile(filename);
Response.Flush( );
Response.End();