Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The cookie may be lost when a window is opened from a modal or modeless HTML dialog box in Internet Explorer 6


View products that this article applies to.

Symptoms

When Microsoft Internet Explorer opens a new window from a modal or modeless HTML dialog box, the new window may appear in a different process and does not contain the cookie information from the dialog box.

↑ Back to the top


Cause

This behavior occurs because Internet Explorer windows that are opened from a from a modal or modeless HTML dialog box may not be opened in the same process.

↑ Back to the top


Workaround

To work around this behavior, pass the window object of the parent of the dialog box into the dialog box, and then use that object to open the new window.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

When Internet Explorer opens a window from a modal or modeless HTML dialog box by using the showModalDialog method or by using the showModelessDialog method, Internet Explorer uses Microsoft Component Object Model (COM) to create a new instance of the window. Typically, the window is opened by using the first instance of an existing Internet Explorer process. This process is different from the process that Internet Explorer uses to open a new window by using the window.open method.

When Internet Explorer opens the window in a new process, all the memory cookies are no longer available, including the session ID.

Sample code

The following sample code is an example of the workaround:

Parent.asp

<html>
<script language="javascript">
function MyShowModal()
{
	var args = new Object;
	args.window = window;
	showModalDialog("modal.asp", args);
}
</script>
<body>
Parent Page<br>
<span>Session ID : <%=Session.SessionID%></span>
<br>
<button onclick="MyShowModal()">Show modal dialog box</button>
</body>
</html>

Modal.asp

<html>
<body>
Modal Page<br>
<span>Session ID : <%=Session.SessionID%></span><br>
<button
  onclick=
    "dialogArguments.window.open('page1.asp')">
Open Page 1 (workaround)
</button><br>
<button
  onclick=
    "window.open('page1.asp')">
Open Page 1 (problem)
</button>
</body>
</html>

Page1.asp

<html>
<body>
Page 1<br>
<span>Session ID : <%=Session.SessionID%></span>
</body>
</html>
To test the workaround, follow these steps:
  1. Save the sample code files Parent.asp, Modal.asp, and Page1.asp on a Web server.
  2. On a client computer, start two new instances of Internet Explorer.
  3. Open Parent.asp in the second instance of Internet Explorer. Notice the session ID on the Web page.
  4. Click Show modal dialog box to open the modal HTML dialog box. Notice the session ID in the dialog box.
  5. Click Open Page 1 (problem) to see the problem. A new window appears. However, the session ID is different from the session ID that you noticed in steps 3 and 4.
  6. Click Open Page 1 (workaround) to see the workaround. A new window appears, and the session ID in this window is the same as the session ID that you noticed in steps 3 and 4.

Outlook Web Access

This problem frequently occurs in Microsoft Outlook Web Access (OWA). To reproduce this problem in OWA, follow these steps:
  1. Close all instances of Internet Explorer.
  2. Start two instances of Internet Explorer.
  3. In the second instance of Internet Explorer, log on to OWA.
  4. Select a message, and then click Reply. The reply window appears.
  5. In the reply window, double-click the recipient's e-mail address to open the E-mail Properties -- Web Page Dialog dialog box.
  6. Click Add to contacts. A new window appears. However, the new window contains the Outlook Web Access Logon page instead of the Contact page.
The new window contains the Outlook Web Access Logon page because the new window opened in the first instance of Internet Explorer. The first instance of Internet Explorer does not have the logon cookie information.

↑ Back to the top


Keywords: KB831678, kbprb, kbdhtml, kbhtml

↑ Back to the top

Article Info
Article ID : 831678
Revision : 3
Created on : 10/28/2005
Published on : 10/28/2005
Exists online : False
Views : 523