Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Display session time out on ASP page

I am having issues with a client who is being kicked out of a web application after they log in only after 10 min.
I have already checked all server settings and they are set to be 999 minutes, yet they get kicked out after 10 min.

I want to display on the screen the time left before the session expires, so that I can prove that the system is NOT kicking them out and its something else.

How can I display the time left on a session using ASP classic ?
SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Checking on the app pool settings
Avatar of Aleks

ASKER

That was not the issue. it was set to 120 minutes.  How can I display the time out left on the screen tho ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

I see that code is for ASP.net. I am using ASP Classic as you can read in my first paragraph.
Avatar of Aleks

ASKER

I am using this script on the page:

function InitSessionTimer() {
   
    warn_sec = 59 * 60 * 1000;             //Warning time in milliseconds
    timeout_sec = 60 * 60 * 1000;          //Actual timeout in milliseconds
    show_warning = true;
    epoch = new Date().getTime();
    CheckSessionStatus();
}
InitSessionTimer();
function CheckSessionStatus() {
   
 
    //Check for session warning
    epoch2 = new Date().getTime();
    if (epoch2 > epoch + warn_sec && epoch2 < epoch + timeout_sec && show_warning) {
        show_warning = false; //Don't show again
        alert_shown = true;
        alert("Your session will timeout in " + Math.round((timeout_sec - warn_sec) / 60000) + " minute, please click a button or navigate to another page to refresh your session before it expires.");
        down = setTimeout("CheckSessionStatus();", 1000);
    } else if (epoch2 > epoch + timeout_sec) {
        alert("Your session has timed out.");
        window.location.href = 'http://yoursite.com/some/page/to/redirect/to';
    } else {
        down = setTimeout("CheckSessionStatus();", 1000);
    }
}

But when I display the session using:

Session:<%=Session("Timeout")%>

Nothing is displayed. Is this the correct name of the session to display ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

thx
Thank you.