?
Solved

content-disposition question for Windows XP, IE6

Posted on 2002-05-16
9
Medium Priority
?
403 Views
Last Modified: 2012-06-27
Hi, I am re-posting this question as I received no previous responses.  I initially made the question 100 points, but have now upped the question to 200 points.

I am using the following lines to allow my ASP page (which is a company report) to be downloaded
as an MS Word doc file.

<%
' ...
Response.ContentType = "application/vnd.ms-word"
Response.AddHeader "content-disposition","attachment; filename=" & strFileName
' ...
%>

When I run the page from home, I am using Windows XP Professional and IE6.  I get the dialog box which says "...open from location or save..."  When I select open from location and click OK, it brings me right back to the same dialog box, "...open from location or save...", and this loop continues indefinitely.

The download works fine on all of our company computers which run Windows 2000 and IE5.5 and lower.

However, some employees who need to access this page remotely from their home systems or laptops may be using Windows XP and IE6; thus, I need to get this fixed.

I've looked around for documentation on this, but found nothing.  Can someone please, at a minimum, point me to documentation (article or other) that discusses why this occurs and any possible fixes, or provide a fix for me.

Thanks
0
Comment
Question by:DJDoug
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 18

Expert Comment

by:mgfranz
ID: 7014429
Try changing the ContentType;

Response.ContentType = "application/msword"
0
 
LVL 2

Expert Comment

by:prokni
ID: 7014468
Have u tried to use inline instead of attachment?
Response.AddHeader "content-disposition","inline; filename=" & strFileName
Alos I agree with mqfranz, use application/msword
0
 
LVL 4

Author Comment

by:DJDoug
ID: 7014536
Prokni--I initially designed it as inline, but the boss wants it as an attachment because the report on the web page contains additional things that don't need to be in the report that employees save or print out.

mgfranz--I made the change and that solved the indefinite looping problem, but it still requires me to choose open from location twice before it actually opens the report in MS Word.  That is, I choose open file from location, it starts a download, then the open/save dialog box pops back up again--I choose open from location again and then it opens in MS Word.  Do I need to adjust the security settings in IE 6 perhaps?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 18

Accepted Solution

by:
mgfranz earned 600 total points
ID: 7014592
Hmm... not sure... there is a patch available at MS that might have something to do with this;  http://support.microsoft.com/default.aspx?scid=kb;EN-US;q313675


Or you might look into using Stream;

<%
'Set the content type to the specific type that you are sending.
Response.ContentType = "application/msword"

Const adTypeBinary = 1
Dim strFilePath

strFilePath = "C:\files\file.doc" 'This is the path to the file on disk.

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath

Response.BinaryWrite objStream.Read

objStream.Close
Set objStream = Nothing
%>
0
 
LVL 4

Author Comment

by:DJDoug
ID: 7014705
I normally download all MS patches/updates as soon as they are available, including the one released yesterday:

http://www.microsoft.com/windows/ie/downloads/critical/q321232/default.asp

The patch from Feb. 11, 2002 turns out to be my problem.  In discussing the security patch from Feb. 11, 2002, Microsoft states:

"After you install this patch, the Open button in the Open dialog box is unavailable if the Content-Type that is specified in the header does not match the file name that is specified in the Content-Disposition header. This behavior is by design for all cases, except if you try to open an .rtf file. To open an .rtf file, save the file, and then open it by using Windows Explorer."

mgfranz, I will award you the points, as I did not discover this until clicking through the links from the Microsoft link you gave me.  For 50 additional points...is there a way around this without using the stream method you suggested?  My strFileName above is something like "myfilename.doc" but the file is actually an ASP generated page, not a doc file sitting on our server.  Or, how would I use the stream method in that case?

Thanks
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7014719
"My strFileName above is something like "myfilename.doc" but the file is actually an ASP generated page"

How are you creatinng the page, and is it being saved or stored in a "temp" folder?  What is the file extension?
0
 
LVL 4

Author Comment

by:DJDoug
ID: 7014754
The page being downloaded is "reportdownload.asp".  This page is called when user clicks on hyperlink (Click here to download an MS Word version of this report.) from "report.asp"

This is the beginning code on reportdownload.asp:

<%
intYear = Request("year")  ' Get year that the user selected to view.
intQuarter = Request("quarter") ' Get quarter that the user selected to view.
printDT = Now() ' Set report print date and time.
strFileName = "Qtr" & intQuarter & "HideMarket" & intYear & ".doc"
' The following two lines create the page as an MS Word attachment.
Response.ContentType = "application/msword"
Response.AddHeader "content-disposition","attachment; filename=" & strFileName
%>

The remaining code is an exact replica of report.asp (which is the ASP page that generates the report in HTML to be viewed on the browser), with only some minor changes.

Sorry I wasn't too clear on that.
0
 

Expert Comment

by:happygirl
ID: 7367937
0
 

Expert Comment

by:happygirl
ID: 7367941
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming…
There is a wide range of advantages associated with the use of ASP.NET. This is why this programming framework is used to create excellent enterprise-class websites, technologies, and web applications.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Through the video, you can check the migration process of Outlook PST file to PDF. Kernel for Outlook to PDF tool can convert Outlook emails with all attributes like Subject, To, From, Cc, Bcc and other folders such as Inbox, Outbox, Sent Items, Jun…

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question