By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,910 Members | 1,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,910 IT Pros & Developers. It's quick & easy.

Modal dialogs causes loss of Session

P: n/a
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 ---

Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Ricky,

As for the Session Lost problem you mentioned, based on my research, it
does be a known issue of the IE browser. When we open a window(via
window.open) from a ModalDialog page, the sessionId won't be the same as
its opener page but is the same with the page in the first instance of IE.
This is caused by the MOdelDialog has broken the SessionId's integrity.
This issue haven't been fixed yet, so currently we have to avoid open new
window from MOdalDialog page. And I'd apologize for any inconvenience it
has bring you.
Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2

P: n/a
Thanks for your reply Steven.

I'm sorry to know that it is a known issue, since this really complicate
things in our application.

I guess the odds of Microsoft fixing this bug must be very small since it
appears that the IE browser is no longer a priority of Microsoft. Otherwise
they'd probably have made a new version long time ago to keep up with the
w3c standards.

Thanks for all you time,
Ricky
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.