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:
- 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 Access
This 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.
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.