473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1749
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.