This problem is specific to Active Document servers that use
IPersistMoniker to read their persistent data; Word 97 and Excel 97 are the
most common examples. When the Active Document server obtains a moniker
through IPersistMoniker::Load and then calls BindToStorage on that moniker
to get the data, URLMON should continue the download in the context of the
original Internet Explorer process that instantiated the Active Document
server. Because of the bug described by this article, URLMON instead starts
a fresh new download in the context of the Active Document server process.
Potential workarounds from the Active Document server side involve removing
IPersistMoniker support or reading directly from the cache file name for
the moniker's associated URL.
Steps to Reproduce Behavior
The following two Active Server Pages (ASP) pages will reproduce this bug.
The first page sets a temporary cookie that should be valid for the entire
session:
Test.asp:
<%@ LANGUAGE="VBSCRIPT" %>
<% ' Check for cookie and add if it does not exist
myCookie = Request.Cookies("mycookie")("test1")
If mycookie = "" Then
Response.Cookies("mycookie")("test1")="OK! The Cookie Exists"
End If
%>
<HTML>
<HEAD><TITLE>A Page That Sets a Temporary Session Cookie</TITLE></HEAD>
<BODY>
<%
If myCookie = "" Then
%>
Cookie Did Not Exist<P>
<%
Else
%>
Cookie Exists<P>
<%
End If
%>
<A HREF="MakeWordDoc.asp">Click Here</A>
</BODY>
</HTML>
As expected, the Web page will display "Cookie Did Not Exist" when first
visited. Subsequent visits and refreshes of the page will display "Cookie
Exists" because the session cookie has now been set in Internet Explorer
for that session.
When clicking on the link in this page, the following MakeWordDoc.asp page
will be evaluated and downloaded. On systems with Microsoft Word installed,
Word will be loaded and hosted inside the Internet Explorer frame window
with the text contents of the evaluated ASP code.
MakeWordDoc.asp demonstrates the problem because the session cookie will
never be valid. The Word document will almost always contain "Error -
Cookie Did Not Exist" on Internet Explorer 4.0x. The results are erratic on
Internet Explorer 3.0x.
MakeWordDoc.asp:
<%@ LANGUAGE="VBSCRIPT" %>
<% Response.ContentType = "application/msword" %>
<% mycookie = Request.Cookies("mycookie")("test1") %>
<% ' Check For Cookie
If mycookie = "" Then
%>
Error - Cookie Did Not Exist
<%
Else
%>
OK! Cookie Exists.
<%
End If
%>