Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Autodownload File

Reply
Thread Tools

Autodownload File

 
 
Mustafa Rabie
Guest
Posts: n/a
 
      02-01-2005
Hi All,

I want to add autodownload like all the one in Downloads.com. When u click
download now link it redirects you to a page that the file downloads the
application after the page is loaded.
how can i do that?

thanks
mustafa


 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Anders_Nor=E5s?=
Guest
Posts: n/a
 
      02-01-2005
Mustafa Rabie wrote:
> I want to add autodownload like all the one in Downloads.com. When u click
> download now link it redirects you to a page that the file downloads the
> application after the page is loaded.
> how can i do that?

You need to do this:
1) The "download" link points to page X.
2) Page X redirects to the zip, exe or other file the user should download.

You can pass the name of the file to download as a query string
parameter to create a dynamic "page X".

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 
Reply With Quote
 
 
 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      02-01-2005
If you view source on their page you will see how they accomplish this.
They are writing an iframe into the document with a src of the file to
download.

This code needs to be somewhere on your page.

for the window.onLoad event the beginDownload method will be called. It
writes out an iframe with the src attribute to download.

The <noscript> tag is processed on browsers that do not support scripts.

hth,

bill

<script language="JavaScript" type="text/javascript">
<!--
function beginDownload() {
idl = -1;
idl = location.search.indexOf("idl=n");
if (idl < 0) document.write('<iframe height="0" width="0"
src="http://myserver.com/downloads/file.exe"></iframe>');
}
window.onLoad=beginDownload();
//-->
</script>
<noscript>
<iframe height="0" width="0"
src="http://myserver.com/downloads/file.exe"> </iframe>
</noscript>


"Mustafa Rabie" <(E-Mail Removed)> wrote in message
news:%23aTlQ%(E-Mail Removed)...
> Hi All,
>
> I want to add autodownload like all the one in Downloads.com. When u

click
> download now link it redirects you to a page that the file downloads the
> application after the page is loaded.
> how can i do that?
>
> thanks
> mustafa
>
>



 
Reply With Quote
 
=?Utf-8?B?UGVuZyBKaWU=?=
Guest
Posts: n/a
 
      02-01-2005
You can do like this in dotnet.

Response.ContentType = ContentType;
Response.AddHeader("Content-Disposition",
"attachment;filename="+Path.GetFileName(Filename)) ;
Response.WriteFile(Filename);
Response.End();


"Mustafa Rabie" wrote:

> Hi All,
>
> I want to add autodownload like all the one in Downloads.com. When u click
> download now link it redirects you to a page that the file downloads the
> application after the page is loaded.
> how can i do that?
>
> thanks
> mustafa
>
>
>

 
Reply With Quote
 
Peter Morris [Droopy eyes software]
Guest
Posts: n/a
 
      02-01-2005
All I think you need is a META REFRESH in the download page. If the target
page is a ZIP etc (can't be displayed visually in the browser) the browser
will open a download dialog instead of navigating.

I do this on my own site in ASP -
http://www.droopyeyes.com/downloads/ecomodeler.asp



--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/


 
Reply With Quote
 
Mustafa Rabie
Guest
Posts: n/a
 
      02-01-2005
thank you for your replies they are very helpful, but the redirect to page x
with the link wont work since it wont display the page.
I want it to be when after the page is loaded and displayed it starts
downloading.

I think the iFrame idea is good, i can hide the iframe and redirect to the
file from inside it.

any feedback and comments is more than welcome of course!

thanks for your help really appreciated
mustafa
"Mustafa Rabie" <(E-Mail Removed)> wrote in message
news:%23aTlQ%(E-Mail Removed)...
> Hi All,
>
> I want to add autodownload like all the one in Downloads.com. When u
> click download now link it redirects you to a page that the file downloads
> the application after the page is loaded.
> how can i do that?
>
> thanks
> mustafa
>



 
Reply With Quote
 
Mustafa Rabie
Guest
Posts: n/a
 
      02-01-2005
i tried that but there's no after page load function in aspx, so i can fire
that code after the page is loaded.

"Peng Jie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You can do like this in dotnet.
>
> Response.ContentType = ContentType;
> Response.AddHeader("Content-Disposition",
> "attachment;filename="+Path.GetFileName(Filename)) ;
> Response.WriteFile(Filename);
> Response.End();
>
>
> "Mustafa Rabie" wrote:
>
>> Hi All,
>>
>> I want to add autodownload like all the one in Downloads.com. When u
>> click
>> download now link it redirects you to a page that the file downloads the
>> application after the page is loaded.
>> how can i do that?
>>
>> thanks
>> mustafa
>>
>>
>>



 
Reply With Quote
 
Mustafa Rabie
Guest
Posts: n/a
 
      02-01-2005
actually this is much easier... thanks peter i think i'll use the meta
refresh
"Peter Morris [Droopy eyes software]" <(E-Mail Removed)>
wrote in message news:(E-Mail Removed)...
> All I think you need is a META REFRESH in the download page. If the
> target page is a ZIP etc (can't be displayed visually in the browser) the
> browser will open a download dialog instead of navigating.
>
> I do this on my own site in ASP -
> http://www.droopyeyes.com/downloads/ecomodeler.asp
>
>
>
> --
> Pete
> ====
> ECO Modeler, Audio compression components, DIB graphics controls,
> FastStrings
> http://www.droopyeyes.com
>
> Read or write articles on just about anything
> http://www.HowToDoThings.com
>
> My blog
> http://blogs.slcdug.org/petermorris/
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting JPG file ppt file [Powerpoint] file zxcvar Digital Photography 7 06-22-2009 07:54 PM
Autodownload Prakash ASP .Net 2 04-17-2006 08:37 AM
autodownload Prakash ASP .Net Building Controls 0 04-17-2006 06:40 AM
In file parsing, taking the first few characters of a text file after a readfile or streamreader file read... .Net Sports ASP .Net 11 01-17-2006 12:44 AM
An Automated process of watching a network file folder, reading a file in it and deleting the file using ASP.NET ? Luis Esteban Valencia Muņoz ASP .Net 3 06-04-2005 10:56 AM



Advertisments