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

Article translations Article translations
Article ID: 831678 - View products that this article applies to.
Expand all | Collapse all

On This Page

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.

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.

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.

STATUS

This behavior is by design.

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.

Properties

Article ID: 831678 - Last Review: October 28, 2005 - Revision: 3.0
APPLIES TO
  • Microsoft Internet Explorer (Programming) 6 (SP1)
  • Microsoft Internet Explorer (Programming) 6.0
Keywords: 
kbhtml kbdhtml kbprb KB831678
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com