The cookie may be lost when a window is opened from a modal or modeless HTML dialog box in Internet Explorer 6
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.
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.
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.
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.
This behavior is by design.
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 codeThe following sample code is an example of the workaround:
<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>
To test the workaround, follow these steps:
<html><body>Page 1<br><span>Session ID : <%=Session.SessionID%></span></body></html>
- Save the sample code files Parent.asp, Modal.asp, and Page1.asp on a Web server.
- On a client computer, start two new instances of Internet Explorer.
- Open Parent.asp in the second instance of Internet Explorer. Notice the session ID on the Web page.
- Click Show modal dialog box to open the modal HTML dialog box. Notice the session ID in the dialog box.
- 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.
- 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 AccessThis problem frequently occurs in Microsoft Outlook Web Access (OWA). To reproduce this problem in OWA, follow these steps:
- Close all instances of Internet Explorer.
- Start two instances of Internet Explorer.
- In the second instance of Internet Explorer, log on to OWA.
- Select a message, and then click Reply. The reply window appears.
- In the reply window, double-click the recipient's e-mail address to open the E-mail Properties -- Web Page Dialog dialog box.
- Click Add to contacts. A new window appears. However, the new window contains the Outlook Web Access Logon page instead of the Contact page.
Article ID: 831678 - Last Review: 06/20/2014 08:37:00 - Revision: 4.0
- kbhtml kbdhtml kbprb KB831678