Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Session sharing manipluation

  • 09-07-2008 3:59pm
    #1
    Closed Accounts Posts: 73 ✭✭


    Hi,

    Im currently developing a web based application and was wondering if some one could point me in the right direction regarding session control.

    Basically the issue is that, in order get to login to the application you need to click on a link from a different web page (parent), which inturn opens a new page (child) in ie06/07.

    The issue is that if the user fails to use the log off functionality provided, but instead just uses the X (on the top right) of the page to the close the page, the session remains active within the "parent" page for x amount of time, which is not exactly desirable.

    Just wondering has anyone catered for this before, and what the easiest ans.


Comments

  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    Off the top of my head, you could set up a JavaScript timer on the parent page to check for the existence of the child page every n seconds.

    If it can't find the page, then initiate an AJAX call to terminate the session?


  • Closed Accounts Posts: 73 ✭✭gerryjuice


    eoin_s wrote: »
    Off the top of my head, you could set up a JavaScript timer on the parent page to check for the existence of the child page every n seconds.

    If it can't find the page, then initiate an AJAX call to terminate the session?

    Cheers eoin, i think something might that might work, but the ideal solution really would be to find something independent of the "parent" page.

    The parent page is just acting as a sort of menu to a number of different applications.


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    Tough one, I don't know how reliable a JavaScript event would be for capturing when a window is closed. Even if you capture the window closing, I don't know if you could be guaranteed that you could close the session properly.

    A different approach could be to have a very short session timeout for the client application (e.g. 2 minutes), but with AJAX calls on the client application that keep the session alive if there is no activity within that time.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    If you are hosting it in IIS each of your applications should be it's own seperate IIS application, that way each application would have an entirely different session from the menu page.


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    stevenmu wrote: »
    If you are hosting it in IIS each of your applications should be it's own seperate IIS application, that way each application would have an entirely different session from the menu page.

    But I think the parent instance of IE (not the opening window as such) will still retain the session information of any child windows.


  • Advertisement
  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Actually you're right, it would, I didn't think that one through fully.


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    I think the short time out + regular requests to keep the session alive is probably the safest option if the OP wants to ensure the session isn't left open when the window is closed. Even a one minute time out with an AJAX call within that time wouldn't have any performance issues.


  • Registered Users, Registered Users 2 Posts: 2,494 ✭✭✭kayos


    Is there not a javascript onwindowclose event (or something like it) that you could work with? Now I will say most of my Javascript was purely for IE and many years ago so not sure if this is something you could work with.


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    kayos wrote: »
    Is there not a javascript onwindowclose event (or something like it) that you could work with? Now I will say most of my Javascript was purely for IE and many years ago so not sure if this is something you could work with.

    There probably is a call like window.onUnload or something, but I don't know if you could rely on it to initiate a server side call to abandon the session in time.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    I don't think there is a sure fire way of doing this with JavaScript. Personally I'd set the timeout for the session and no-more. In time you could review the site logs and get an average time for inactivity to base you timeout on.

    But seeing as its IE6/7 would vbscript be an option? It might have events that are unsupported in javascript.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,045 ✭✭✭Bluefrog


    Not sure if I am understanding what you are trying to do here but if you kill the session on the child page with ajax won't you kill the session on the parent page too if the child apps are using the same session store?

    Rather than using popup windows to do this, have you considered using something like a floating iframe - much more controllable than a window in terms of how your user can interact with it.

    Either that or polling either client-side or server side for user interaction will be required.


Advertisement