Using response.addheader for pushing file

Discussion in 'ASP General' started by Bertrand, Nov 11, 2003.

  1. Bertrand

    Bertrand Guest

    Hello,

    I am using an ASP form to collect some info from users,
    that info is them inserted into an Excel file (copy of a
    template that resides on the server .. I use fso.copy to
    copy the template first and name according to same
    params) ..
    I then offer that file for download to the users ... I
    first had a link and explained to users that they should
    use right-click and then save target as .. however because
    I now replaced the link by a button (to allow me to
    perform some additional actions - like sending an email),
    I would also like to 'push' the file towards the user and
    force the download (now, I do know that users will still
    always have the coice between download and open ...)

    furthermore the problem I am having is just too weird and
    I would like someone to explain if possible ...
    so ... as said. a template excel file is copied on a
    server to a new file still on the server .. the name of
    that new file is dynamically created (to avoid writing
    over other users files) and after a while, the users
    should be able to download it .. when I use the following:

    Response.AddHeader "content-disposition","attachment;
    filename=""" & server.URLPathEncode(request.form("File"))
    & """"

    the weirdest thing happens ... the file is tiny & empty
    (as in, the single worksheet in there is empty) ..
    furthermore, the worksheet is renamed to the name of the
    file and the hwole thing is useless of course .. if I
    check the server, I do see that the file is present .. so
    how come the server/browser (?) chose to transform my file
    as it was downloaded .. stripping it of any content and
    renaming the worksheet to the file name? ... fyi, the
    excel file does cotnain macro's ..

    I hope someone can shed some light on this ..

    thanks,

    kindest regards,

    Bertrand
     
    Bertrand, Nov 11, 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. Joseph
    Replies:
    2
    Views:
    5,593
  2. S.Kartikeyan

    Response.AddHeader content-disposition

    S.Kartikeyan, Feb 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,968
    S.Kartikeyan
    Feb 6, 2004
  3. S.Kartikeyan
    Replies:
    0
    Views:
    2,801
    S.Kartikeyan
    Mar 1, 2004
  4. Peter Torr \(MS\)
    Replies:
    0
    Views:
    416
    Peter Torr \(MS\)
    Oct 25, 2004
  5. Andyza
    Replies:
    1
    Views:
    601
    Anthony Jones
    Feb 16, 2007
Loading...

Share This Page