472,967 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,967 software developers and data experts.

Automatic Download start...

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

Nov 19 '05 #1
1 1733
Ok, I was able to do it... In the page load event I used:

string scriptString = "<script language=JavaScript> function DoStartup() {";
scriptString += "downloadTimer = setTimeout('startDownloadTimer()', 1000);}";
scriptString += "function startDownloadTimer() {";
scriptString += "clearTimeout(downloadTimer);";
scriptString += "location.href='" + program.Download1 + "';}<";
scriptString += "/";
scriptString += "script>";
if(!this.Page.IsStartupScriptRegistered("Startup") )
this.Page.RegisterStartupScript("Startup", scriptString);

I worked!

Thanks,

Iulian Ionescu
http://www.olvio.com/
--
Regards,

Iulian
"Iulian" wrote:
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: William Ryan | last post by:
Are you using an intranet or the internet to push the updates? If the internet, you probably can't get there without a web server. If you are using an intranet, you can do it from a shared...
0
by: jmd | last post by:
Hello. I want to write a C# program that does completely automatically what, until now, I do manually, witch is describe below : 1. I launch IE (6) 2. I browse to my desired download page, say...
2
by: Trygve Lorentzen | last post by:
Hi, I'm developing an app with automatic version checking and updating. It must also track what version is installed for each customer in our customer database. I have made a small client to...
18
by: jmd | last post by:
Hello, I posted the following in the C# forum but without one answer. But perhaps now in vb.net someone has some guidelines ! This is my question : I want to write a vb.net program that does...
1
by: rdemyan via AccessMonster.com | last post by:
My App has 10 or so tables that we provide that contains proprietary data. This data will need to be updated once or twice a year. I would like some comments, suggestions on my proposed strategy...
0
by: ar | last post by:
Hello, In IE I disable "Automatic prompting for file downloads" which causes the IE information bar to show up when I try to push a file download from an iframe. I want to keep this behaviour. ...
2
by: Jan Paul van de Berg | last post by:
I have a piece of software that people can download and a third party promoting that software. In order for them to be able to count the number of downloads, I have to put a tracking code on my...
6
by: Mike Saunders | last post by:
I have a basic web site where people can download my programs. To make it easier for them is it possible that I could add some javascript that would allow them to automatically install/run the...
25
by: sidd | last post by:
In the following code: int i = 5; ---it goes to .data segment int j; ---it goes to bss segment int main() { int c; int i = 5; ---stack
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.