Wednesday, April 14, 2010

Modal dialogs causes loss of Session in I.E.

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 (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.

Solution :

As for the Session Lost problem, 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.

No comments:

Post a Comment