how to force download

  • Thread starter Thread starter greg
  • Start date Start date
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
 
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
 
Back
Top