ak123
ak123

Reputation: 295

Reset session timeout programmatically

In my project I have a requirement where in I want to alert an user with a popup whenever the inactive time is about to hit the session timeout time(For ex:5 mins in advance of session expiry), so that the user can click on continue button and programmatically extend the server session.

What's the best approach to do this?

Upvotes: 0

Views: 3135

Answers (2)

WhoaItsAFactorial
WhoaItsAFactorial

Reputation: 3558

You can do it with javascript and coldfusion.

<!--- Minutes into MS --->
<cfset sessionTimeout = 2>
<html>

<head>
<title>Timeout Example</title>

<script>
<cfoutput>
var #toScript((sessionTimeout-1)*60*1000,"sTimeout")#
</cfoutput>
setTimeout('sessionWarning()', sTimeout);

function sessionWarning() {
   alert('Hey bonehead, your session is going to time out unless you do something!');
}
</script>

</head>

<body>

</body>
</html>

Taken from http://www.webpronews.com/warn-a-user-about-a-session-timeout-with-javascript-2007-01

Upvotes: 1

Related Questions