Modal dialogs causes loss of Session

  • Thread starter Ricky K. Rasmussen
  • Start date
R

Ricky K. Rasmussen

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 ---
 
S

Steven Cheng[MSFT]

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
 
R

Ricky K. Rasmussen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top