how to force download

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • greg

    how to force download

    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.Naviga teUrl = Request.Applica tionPath + "/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


  • Steve C. Orr [MVP, MCSD]

    #2
    Re: how to force download

    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.Conten tType = Whatever
    Response.Writef ile("c:\whateve r.iif")
    Response.AddHea der("Content-Disposition",
    "attachment;fil ename=whatever. iif")
    Response.End()

    Here are more details:


    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP



    "greg" <info@ebsdevelo pmentNOSPAM.com > wrote in message
    news:OVe31IxuFH A.3528@TK2MSFTN GP15.phx.gbl...[color=blue]
    > 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.Naviga teUrl = Request.Applica tionPath + "/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
    >
    >[/color]


    Comment

    Working...