Hi
I want to make a download link on my ASP page, however if I use a Hyperlink,
this just tries to open the file in the browser and does nothing if the file
is of an unknown type. If I right click the file, I can download it as
usual.
What do I do to get a button or a hyperlink to open the file download dialog
when such a link clicked?
Thanks for any help
Kind regards
MW 4 1306
Frank made a post later today where he does what you want.
This will help you on your way :
Response.AddHeader("Content-Disposition", "attachment;filename=test.txt")
Cheers,
Tom Pester Hi
I want to make a download link on my ASP page, however if I use a Hyperlink, this just tries to open the file in the browser and does nothing if the file is of an unknown type. If I right click the file, I can download it as usual.
What do I do to get a button or a hyperlink to open the file download dialog when such a link clicked?
Thanks for any help
Kind regards MW
You can use code something like this:
Response.Clear()
Response.ContentType = Whatever
Response.Writefile("c:\whatever.doc")
Response.AddHeader("Content-Disposition", _
"inline;filename=whatever.doc")
Response.End()
Here's more info: http://SteveOrr.net/articles/EasyUploads.aspx
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://SteveOrr.net
"MW de Jager" <mw*******@privatemail.me.uk> wrote in message
news:d8**********@ctb-nnrp2.saix.net... Hi
I want to make a download link on my ASP page, however if I use a Hyperlink, this just tries to open the file in the browser and does nothing if the file is of an unknown type. If I right click the file, I can download it as usual.
What do I do to get a button or a hyperlink to open the file download dialog when such a link clicked?
Thanks for any help
Kind regards MW
Thanks Steve, this works.
I did however have to change the "inline;filename=whatever.doc"
to "attachment;filename=whatever.doc"
Kind regards
MW
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... You can use code something like this:
Response.Clear() Response.ContentType = Whatever Response.Writefile("c:\whatever.doc") Response.AddHeader("Content-Disposition", _ "inline;filename=whatever.doc") Response.End()
Here's more info: http://SteveOrr.net/articles/EasyUploads.aspx
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"MW de Jager" <mw*******@privatemail.me.uk> wrote in message news:d8**********@ctb-nnrp2.saix.net... Hi
I want to make a download link on my ASP page, however if I use a Hyperlink, this just tries to open the file in the browser and does nothing if the file is of an unknown type. If I right click the file, I can download it as usual.
What do I do to get a button or a hyperlink to open the file download dialog when such a link clicked?
Thanks for any help
Kind regards MW
Say for instance I want to do a file download from another website, but also
link this to a button.
I tried to do this with
Response.WriteFile("http//www.myglobalsite.com/files/testfile.dat"), but the
browser complains about the URL not being a virtual directory.
Any ideas?
Kind regards
MW
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... You can use code something like this:
Response.Clear() Response.ContentType = Whatever Response.Writefile("c:\whatever.doc") Response.AddHeader("Content-Disposition", _ "inline;filename=whatever.doc") Response.End()
Here's more info: http://SteveOrr.net/articles/EasyUploads.aspx
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"MW de Jager" <mw*******@privatemail.me.uk> wrote in message news:d8**********@ctb-nnrp2.saix.net... Hi
I want to make a download link on my ASP page, however if I use a Hyperlink, this just tries to open the file in the browser and does nothing if the file is of an unknown type. If I right click the file, I can download it as usual.
What do I do to get a button or a hyperlink to open the file download dialog when such a link clicked?
Thanks for any help
Kind regards MW
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
by: Buddy Ackerman |
last post by:
I am trying to implment a file download via a link such that when clicked,
instead of starting the default application for that type of file the user
will be presented with a download dialog...
|
by: Skwish |
last post by:
Hi,
I would like to download all the files from a folder (of various types i.e.
..txt, .dll, .dat, etc.). I tried
Dim MyDir As IO.Directory
Dim path As String = Me.MapPath(".") & "\Data"
Dim...
|
by: theyas |
last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE
I've asked about this before and didn't get a...
|
by: Rukmal Fernando |
last post by:
Hi all,
I have a file retrieved from a database and I want to return it over a web
page.
I currently have an ASPX page (Download.aspx) with code similar to the
following in Page_Load():
...
|
by: Rhys666 |
last post by:
Basically I have a link that opens my download page and the querystring
identifies the type of 'template' Excel spreadsheet has asked to download.
The download page reads the querystring,...
|
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...
|
by: rony_16 |
last post by:
Hi,
I have problem with downloading a file using WebRequest and
HttpWebResponse.
Inorder to download this file i need to call to url that tells to
prepare the file for download,
and then i call...
|
by: bfmcfarlane |
last post by:
I have an appication that allows users to upload and download files.
This application is only accessed when a user clicks on an "Upload /
Download" link from within our main application. A new...
|
by: nathj |
last post by:
Hi,
I am currently working on a new site that offers various files for download. The file information is stored in a MySQL database and the page is produced in PHP depending on how the user got...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
| |