ActiveFile, XP+SP2, file download does not work

From: Bobby Ballard (bobbyb_at_REDEPOSIT.COM)
Date: 10/08/04

  • Next message: Russ: "Disclosure Debate - yet again"
    Date:         Fri, 8 Oct 2004 15:30:57 -0400
    To: NTBUGTRAQ@LISTSERV.NTBUGTRAQ.COM
    
    

    Russ,

    If you use the ActiveFile control to download files to your clients
    using IE then you will find that the behavior of the
    Browser changes with the addition of SP2 to XP.

    Previous behavior: IE would prompt to download a file.
    New behavior: IE opens the file using the file association in the OS.
    Even though .txt files are usually associated with
    Notepad, IE will open the file and display the contents in the browser.

    Here's some old code that will display the file in the browser rather
    than prompt for download:

            Set File = Server.CreateObject("ActiveFile.File")
            File.Name = "d:\websites\download\"+this_filenamex
            Response.Clear
            Response.AddHeader "Content-Disposition", "inline; filename=" &
    File.FileName
            File.Download "application/unknown",now(),true,true

    The fix for this problem is to change the "inline" attribute in
    "Content-Disposition" to "attachment" and this will force a download of
    the file, even for known MIME types like MS Word. The new line of code
    would read:

             Response.AddHeader "Content-Disposition",
    "attachment;filename=" & oFile.FileName

    In addition, if you leave "inline" in place and put a backslash in front
    of the file name then you will get a prompt to save
    the file using the current asp file name.

    Also, if you delete the file association for .txt in the OS then IE will
    open the file in Notepad not IE. This was old behavior.

    Some of this is documented by MS at:
    http://support.microsoft.com/default.aspx?scid=http://support.microsoft.
    com:80/support/kb/articles/Q260/5/19.ASP&NoWebContent=1

    IMHO, it looks like "inline" never worked correctly and now MS is
    correcting it without notifying us lowly programmers.

    Hope this helps.

    Regards,
    Bobby Ballard
    bobbyb@redeposit.com

    --
    NTBugtraq Editor's Note:
    Want to reply to the person who sent this message? This list is configured such that just hitting reply is going to result in the message coming to the list, not to the individual who sent the message. This was done to help reduce the number of Out of Office messages posters received. So if you want to send a reply just to the poster, you'll have to copy their email address out of the message and place it in your TO: field.
    --
    

  • Next message: Russ: "Disclosure Debate - yet again"

    Relevant Pages

    • Re: Cant SAVE file download , only RUN
      ... Internet Explorer Opens .exe Files Instead of Downloading Them ... the "Confirm open after download" box ... Open a DOS window and enter at the prompt "ipconfig ... > Installing Real Player, or inadvertently installing the DVD player ...
      (microsoft.public.windows.inetexplorer.ie6.browser)
    • Need to download exact copy of text file...little squares replace carriage returns
      ... I need to download a text file from my server. ... program to email it and another to make the browser download the file ... client into my local browser and it opens up in notepad without the ...
      (comp.lang.perl.misc)
    • IE6 Not Working
      ... but since I can't download anything with my IE ... You may have to enable Hidden files. ... Replies are posted only to the newsgroup for the benefit or other readers. ... I've also set the option as you described and restarted the IE browser, ...
      (microsoft.public.windows.inetexplorer.ie6.browser)
    • Re: Windows Explorer Hangs...Why?
      ... is trying to connect and download the page but nothing happens. ... But assuming you are a serious and you have trouble with your browser! ... Click on General Tab and you will see a Button called ... On how to disable the Add-ons follow this: ...
      (microsoft.public.windowsxp.help_and_support)
    • Re: Holy cow have I been hijacked
      ... Since then, my browser is hosed- search engines are hijacked, leading ... I click any links for download of the software. ... Superantispyware (download link not found, ... The solution is to get a program such as Acronis True Image. ...
      (alt.comp.anti-virus)