Microsoft KB Archive/831678

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

Article ID: 831678

Article Last Modified on 10/28/2005

-

APPLIES TO


 * Microsoft Internet Explorer (Programming) 6 (SP1)
 * Microsoft Internet Explorer (Programming) 6.0

-





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
 function MyShowModal {   var args = new Object; args.window = window; showModalDialog(&quot;modal.asp&quot;, args); } Parent Page Session ID : <%=Session.SessionID%> Show modal dialog box

Modal.asp
Modal Page Session ID : <%=Session.SessionID%>  Open Page 1 (workaround)  Open Page 1 (problem)

Page1.asp
Page 1 Session ID : <%=Session.SessionID%> 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.

Keywords: kbhtml kbdhtml kbprb KB831678

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.