G
Guest
Hi, I am working on a directory type of site and I got stuck in the following
problem:
when the user clicks on the download link I present a page that sais:
"Contacting download site... If the download does not start in 10 sec. please
click the link below". At this point I would like to attempt to download the
file and send it to the client. One think I managed to do is to call a
"DownloadBridge.aspx" page from the Body's onload event and in here I am
overriding the OnLoad and I am trying to put the file into the Request.
Normally, if this file would come from the server itself I would do:
Response.Clear();
Response.AppendHeader("Content-Disposition", "attachment; filename=" +
fileinfo.Name);
Response.AppendHeader("Content-Length", fileinfo.Length.ToString());
Response.ContentType = "application/octet-stream";
s = new System.IO.FileStream(fileinfo.FullName, System.IO.FileMode.Open);
Response.WriteFile(s.Handle, 0, fileinfo.Length);
But the problem is that this time, the source of the file is not a physical
location on the server, instead it is an URL to a different location, let's
say "www.whatever.com/file.zip". How do I take the stream from the source
file and send it with the request to the client? Also, I hope this can be
achieved without the need to actually download the file on the server and
then sending it to the client with the method above... I just want to
transfer the stream...
Any help appreciated,
Thank you,
Iulian
problem:
when the user clicks on the download link I present a page that sais:
"Contacting download site... If the download does not start in 10 sec. please
click the link below". At this point I would like to attempt to download the
file and send it to the client. One think I managed to do is to call a
"DownloadBridge.aspx" page from the Body's onload event and in here I am
overriding the OnLoad and I am trying to put the file into the Request.
Normally, if this file would come from the server itself I would do:
Response.Clear();
Response.AppendHeader("Content-Disposition", "attachment; filename=" +
fileinfo.Name);
Response.AppendHeader("Content-Length", fileinfo.Length.ToString());
Response.ContentType = "application/octet-stream";
s = new System.IO.FileStream(fileinfo.FullName, System.IO.FileMode.Open);
Response.WriteFile(s.Handle, 0, fileinfo.Length);
But the problem is that this time, the source of the file is not a physical
location on the server, instead it is an URL to a different location, let's
say "www.whatever.com/file.zip". How do I take the stream from the source
file and send it with the request to the client? Also, I hope this can be
achieved without the need to actually download the file on the server and
then sending it to the client with the method above... I just want to
transfer the stream...
Any help appreciated,
Thank you,
Iulian