how to force download

G

greg

Hi

I have a link on a page that points to a file inside the site that I want to
be downloaded
loke in page_load I write

linkFile.NavigateUrl = Request.ApplicationPath + "/somepath/file.iif";

This file is a text file so when user clicks onthat link it displays in the
browser
the contents of that file (it is a text file although with ext iif)

How do i force browser to display dialog like where to save it?

Thanks
GSL
 
S

Steve C. Orr [MVP, MCSD]

Yes, you can force a dialog box that will ask the user whether they'd like
to open or save the file:

Response.Clear()
Response.ContentType = Whatever
Response.Writefile("c:\whatever.iif")
Response.AddHeader("Content-Disposition",
"attachment;filename=whatever.iif")
Response.End()

Here are more details:
http://SteveOrr.net/articles/EasyUploads.aspx
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top