Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 398
  • Last Modified:

content-disposition question for Windows XP, IE6

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
DJDoug
Asked:
DJDoug
  • 3
  • 3
  • 2
  • +1
1 Solution
 
mgfranzCommented:
Try changing the ContentType;

Response.ContentType = "application/msword"
0
 
prokniCommented:
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
 
DJDougAuthor Commented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
mgfranzCommented:
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
 
DJDougAuthor Commented:
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
 
mgfranzCommented:
"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
 
DJDougAuthor Commented:
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
 
happygirlCommented:
0
 
happygirlCommented:
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now