Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > initiating a file download via a Button

Reply
Thread Tools

initiating a file download via a Button

 
 
matt@mailinator.com
Guest
Posts: n/a
 
      11-22-2005
hello,

how does one inititate the dowloading of a file via a button click? for
example, i have a file sitting on the webserver; when the user clicks
on a button, i'd like them to see their web browser's "save this file
to the file system" dialogue and have them download it.

im not even sure if this would be server-side or client-side. either
works for me.

any tips?

thanks!
matt

 
Reply With Quote
 
 
 
 
Robbe Morris [C# MVP]
Guest
Posts: n/a
 
      11-22-2005
Just redirect the user to that file like you would
any other url.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net





<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> hello,
>
> how does one inititate the dowloading of a file via a button click? for
> example, i have a file sitting on the webserver; when the user clicks
> on a button, i'd like them to see their web browser's "save this file
> to the file system" dialogue and have them download it.
>
> im not even sure if this would be server-side or client-side. either
> works for me.
>
> any tips?
>
> thanks!
> matt
>



 
Reply With Quote
 
 
 
 
matt@mailinator.com
Guest
Posts: n/a
 
      11-22-2005
....that didnt work for me for some reason.

no sweat tho, i found another way:

//send file to user
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("content-disposition", "attachment; filename=" +
fileName);
Response.Flush();
Response.WriteFile(fileAbPath);
Response.End();

....this has an added advantage of allowing me to use a dynamically
generated filename. cool.


thanks,
matt

 
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
Problem displaying page before initiating file download Richard L Rosenheim ASP General 0 01-30-2005 12:02 AM
firefox freezes when initiating downloads Glen S Firefox 4 01-26-2005 09:42 PM
Initiating file download after form submit Tim Fooy HTML 3 08-13-2004 10:07 AM
Cisco Router initiating L2TP tunnel to Microsoft RAS cheechew Cisco 0 06-12-2004 01:16 PM
Cisco Router initiating L2TP tunnel to Microsoft RAS cheechew Cisco 0 06-12-2004 12:50 PM



Advertisments