Click to See Complete Forum and Search --> : Forcing a download


GlennCarter
12-09-2003, 04:56 AM
Is there any way to force the browser to download a PDF rather than viewing it when you click a link to it?

Thanks for any help.

PeOfEo
12-09-2003, 05:45 PM
You can open it up in a download prompt. I do not know how in asp, but I have some code in asp.net, Ill post some of it and maybe it will be of use to you.


Response.Clear()
Response.AddHeader("content-disposition", "attachment; filename=" & SelectedFSItem.Value)
Response.WriteFile(dlFile)
Response.Flush()
Response.End()

GlennCarter
12-11-2003, 02:53 AM
Unfortunately the response.writefile method doesn't exist in ASP. I'll keep looking...

MichaelM
12-11-2003, 11:29 AM
Response.BinaryWrite may work instead of the .WriteFile method...

never tried it myself that way, but it might work?!