Downloading a file...

Discussion in 'ASP .Net' started by Ian Gordon, Jul 30, 2003.

  1. Ian Gordon

    Ian Gordon Guest

    Hi,

    I have 2 problems when downloading a file from my ASP.net app to the client
    PC. At the moment I'm doing it with the following code:

    Response.ContentType = "application/octet-stream"

    Response.AddHeader("Content-Disposition", "attachment; filename=" +
    strFileToDownload)

    Response.WriteFile(strFileToDownload)



    The problems are:
    1. How can I set the name of document to be downloaded? At the moment, the
    name of file is by default set to be the name of the web form that it comes
    from, which is far from ideal. to be able to call it, for example,
    myFile.doc.
    2. How can I try and force the save to be in a specific directory, or even
    to default to the Windows temp directory, or to My Documents? At the moment,
    the default target directory seems quite different on different machines.

    All help very much appreciated.

    Ian
    Ian Gordon, Jul 30, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Morrison

    Downloading a file from a website

    Chris Morrison, Dec 18, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    506
    Vijayakrishna Pondala
    Dec 31, 2003
  2. Replies:
    0
    Views:
    405
  3. Steven

    Downloading a file

    Steven, Jul 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    387
    Joerg Jooss
    Aug 2, 2003
  4. Ian Gordon

    Downloading a file to client

    Ian Gordon, Jul 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    352
    Bill Priess
    Jul 30, 2003
  5. buran
    Replies:
    0
    Views:
    371
    buran
    Sep 13, 2003
Loading...

Share This Page