ActiveFile, XP+SP2, file download does not work
From: Bobby Ballard (bobbyb_at_REDEPOSIT.COM)
Date: 10/08/04
- Previous message: David Kennedy CISSP: "Re: [Full-Disclosure] RE: Disclosure policy in Re: RealPlayer vulnerabilities"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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. --
- Previous message: David Kennedy CISSP: "Re: [Full-Disclosure] RE: Disclosure policy in Re: RealPlayer vulnerabilities"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|