Labels

Thursday, December 4, 2008

Opening New Window - Session Sharing Problem

Hi,

 

Here I have discussed how to avoid Session sharing between parent-child windows.

Here Parent Window refers to window which can open another window from it - using ‘Window.Open’ / File | New | Window / Ctrl + N 

 

Problem - Let me brief the story.

 

  • Open a new browser widnow and type in some URL.
  • Open a child widnow from it using by either mean as below.

 

    • File -> New -> Window OR
    • Ctrl + N  OR
    • Window.Open(window.location.pathname,’’,’’)
    • Window.Open(‘http:/localhost/TrialSite/Login.aspx’,’’,’’)   // Open Login page in the new child window

 

All four of the above solution opens a new window, with the current page been displayed in the new window (Child Window) using the first three bullets.

 

  • Problem – Here the problem is that the Session is shared between these two windows. The session is also shared if we keep opeing the new windows from every new child window or from the top parent window (First Bullet).

 

Solution –

 

Solution is to go for another approach – Launch Browser with Login.aspx as URL. This can be achieved, however have few hiccups.

 

 

Client Side Approach

 

  • Works for IE.
  • Also session is not shared.

 

  • Does not work for FF.
  • Need to explore more for FF.

 

 

Server Side Approach

 

 

  • Works for IE.
  • Also session is not shared.

 

  • Does not work for FF. i.e. it allows to open new window. But after you make login in the new/child window, any server side operation in the parent window pushes the flow to login page for the parent window.

 

Now again, after you make login in the parent window, any server side operation in the new/child window pushes the flow to login page for the new/child window.

 

 

Also the server side approach for IE & FF both requires providing executable rights to the code, which I believe can be risky.

 

 

 

 

 

Thanks & Regards,

Arun Manglick || Senior Tech Lead

 

 

 

Thanks & Regards,

Arun Manglick || Senior Tech Lead

 

2 comments:

  1. Sir jee...

    Client Side Approach & Server Side Approach ka code bhi to batao.... :)

    Paresh B

    ReplyDelete
  2. Check the Code at - http://arun-ts.blogspot.com/2009/01/code-new-window-and-session-sharing.html

    ReplyDelete