Results 1 to 4 of 4

Thread: Popup reminder before session ends

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    USA
    Posts
    74

    Exclamation Popup reminder before session ends

    Hi All,

    We have an ASP.Net application v1.1
    We have a request that we inform users 5/10mins before session timesout.
    The question I have is, how can I implement this on a global level with no/minimum change to existing code?
    If I am going in the wrong direction, can someone please tell me how to resolve this issue?

    Heres what I have till now:
    In .aspx page i have this scritp written
    <script language='JavaScript'>
    function fncSetTimeout()
    {
    window.setTimeout('alertUser()',10000);
    }
    function alertUser()
    {
    var newWindow = '';
    alert('Session is about to expire');
    newWindow=window.open('WebForm1.aspx', 'CyberSure','scrollbars=no,resizable=no,width=580,height=500,left=200,top=50, menu=no');
    newWindow.opener = self;
    }
    </script>

    on page load I call this script
    Dim strTimerScript As String = "<script language='JavaScript'>fncSetTimeout()" + ";<" + "/" + "script>"
    Page.RegisterStartupScript("timerScript", strTimerScript)


    Thanks in advance
    Manju
    Thanks
    Manju

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Popup reminder before session ends

    What is the new window for?

    Is the purpose just to inform the user or do you actually want to keep the session alive?

    If it's simply to inform the user, then opening up an ASP.NET page as you are doing currently will defeat its own purpose, because it acts as 'browsing to another page', and that will in turn keep the session alive. You should use an HTML page for this if you simply want to inform the user.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    USA
    Posts
    74

    Re: Popup reminder before session ends

    Thanks for your response.
    The popup is to keep the session alive.

    I am wondering if there is a way I can load the javascript globally at some place in the app, so every page will automatically be checked for timeout.

    Thanks in advance
    Manju
    Last edited by manju; Jul 16th, 2008 at 05:09 PM.
    Thanks
    Manju

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Popup reminder before session ends

    If it's to keep the session alive, then you don't even need the popup. You can do something like this (an invisible image on the page itself)

    <img width="1" height="1" src="blankpage.aspx" />

    blankpage.aspx is just a normal ASP.NET page, but you can use javascript (set a timer) to keep refreshing the image every minute. This way the requests will go out and because the page gets requested, the session stays alive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width