Session Timeout Notification & Multiple Windows

6 posts, 0 answers
  1. J. E.
    J. E. avatar
    15 posts
    Member since:
    May 2011

    Posted 09 Aug 2011 Link to this post

    Hi all,

    I love the new notification control. I have been playing around with it and had a quick question. Right now, I have placed the control on the MasterPage for our application. While testing out the SessionTimeout example, I noticed that if I open a link in another tab or window, you run the risk of the notification appearing in multiple windows. Any one have any ideas how I can control the notification from appearing more than once or appearing pre-maturely in the original window?

    Thanks,
    JE
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 11 Aug 2011 Link to this post

    Hello J. E.,

    This is a really complex scenario which I am not sure is entirely possible. There are several approaches you can take and each has its drawbacks and limitations:

    1) raise a flag in a Session[] variable when you open a content page. This flag can be used by the RadNotification to determine if the session has been prolonged by another page being requested. You can set this flag as the Notification's Value and check for it in the JavaScritpt. The exact way you will raise a flag and pass its value depends on your custom scenario - you coul use a hidden field as well. This will need the notification to perform a callback to update is content when it is about to show the redirect timer. Thus you can avoid the redirect, if necessary, but this will also prolong the user session if no other page has been opened. The redirect would still occur if your custom logic is correct, but the Session on the server will not be closed.

      2) find a way to access your pages via JavaScript, for example by storing references to the newly opened windows in global variables, then you can raise e flag in the old pages which will prevent the countdown of the notification even as you click the links from them. This would be possible if you only access other pages from within the first one opened, if you simply open a new tab and type in the address you could not access them

    3) move the notification only to the desired content page to avoid duplicates.

    Please note that there may be more ways to attack this and there maybe more issues that I have not foreseen in my suggestions. All this is a complex custom functionality that we do not support and it is the developer's responsibility to find a way to access his/her pages/controls.

    All the best,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. J. E.
    J. E. avatar
    15 posts
    Member since:
    May 2011

    Posted 19 Aug 2011 Link to this post

    Hi Marin,

    Thank you for the response. I am still reviewing your suggestions, but I don't necessarily agree that this scenario is custom behavior. Users can choose to open a hyperlink in a separate window/tab by asking the browser to do so. We haven't coded this behavior, it is part of the browser and it is something that needs to be considered by the developers when using this new control.

    As I said in my original post, we really do like the control, but we will need to consider how to use it, to prevent multiple notifications or pre-mature session timeouts.

    Thanks again.
    JE
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 22 Aug 2011 Link to this post

    Hi J. E.,

    The RadNotification is simply a control that allows for the popup to become visible on the page as directed by the developer of the application. This means that if or when it should be shown is not decided by the control, but by the developer.

    Determining when/if the session has ended or is renewed is nearly impossible via JavaScript, as this is a server-side object, and if you have a round-trip to the server to check it this will also renew it. This is the main difficulty in implementing such a notification, especially in a multipage scenario.

      Therefore if you are able to detect session start/end/near expiration via JavaScript then this is how and when you can show the notification, but we cannot provide it internally. This is also the reason why I call this a custom behavior.

    While I am glad to hear that you like this new control I cannot say that all scenarios are possible with it, as the technology has some innate limitations. This is why I can recommend another approach - instead of redirecting you can make the tabs flash a message, so even if the warning comest early the user will, at leas,t not be redirected to a new page.


    Greetings,
    Marin
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Edward
    Edward avatar
    5 posts
    Member since:
    Mar 2011

    Posted 08 Jun 2012 Link to this post

    Hi Marin and J.E.

    What about the use of AJax page.methods and APS.Net WebMethods.  There is someone else at http://stackoverflow.com/a/7029210/1161391 who is using these to poll the server every 30 seconds to see if the session has expired.  Do these callbacks keep the session alive?  (I seem to remember some issues with another timeout notification tool where they said that AJAX callbacks from within a update panel did not refresh the session.)
  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 12 Jun 2012 Link to this post

    Hi Edward,

    Such requests keep the session alive and you can confirm this in the SessionTimeout demo - it uses a callback (not even an AJAX request) to renew the session if you click the ContinueSession button. You can do this a few times and you will see the session is still active.


    Kind regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017