File download from my ASP page

M

MW de Jager

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
 
T

tom.pesterDeLeTeTHISSS

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
 
M

MW de Jager

Thanks Steve, this works.

I did however have to change the "inline;filename=whatever.doc"
to "attachment;filename=whatever.doc"

Kind regards
MW
 
M

MW de Jager

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top