Hi NG,
We have a rather large ASP.NET application that uses popups to display
various dialogs to the user. In our work we've come over a rather annoying
"bug":
If we open a modal dialog using the javascript command
window.showModalDialog() we loose the current Session if a new window is
opend from within the modal one (using the window.open() method). The
"funny" thing is that this only occurs if another instance of IE has been
opend prior to the one serving the dialog.
Let me give an example:
1.
Open an instance of IE and navigate to www.google.com.
2.
Open a new instance of IE and navigate to the ASP.NET page included at the
end of this post (served through an IIS).
3.
Click the link "1. Open new modal dialog", and a modal dialog containing the
page is displayed.
4.
Click the link "2. Open new window" from the new modal dialog and a new
window
containing the page is displayed.
5.
Notice that a new session is used when displaying the last page/window.
Can anyone tell me if this is a bug, or how to work around it?
Thanks for your Time,
Ricky
--- start of ASP.NET Page ---
<%@ Page Language="C#" EnableSessionState="true" %>
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
//Ensure that the Session is used
Session["SessionDate"] = DateTime.Now;
//Write the IsNewSession to output
Literal1.Text = Session.IsNewSession.ToString();
}
</script>
<html>
<head>
<title>Test page</title>
<script language="javascript">
function openWindow()
{
window.open('<%= Request.Url.ToString() %>');
}
function openDialog()
{
window.showModalDialog('<%= Request.Url.ToString() %>');
}
</script>
</head>
<body>
<form runat="server">
IsNewSession: <asp:Literal id="Literal1"
runat="server"></asp:Literal>
<br />
<a onclick="openDialog()" href="#">1. Open new modal dialog</a>
<br />
<a onclick="openWindow()" href="#">2. Open new window</a>
</form>
</body>
</html>
--- end of ASP.NET Page ---