Friday, December 12, 2008

Raghuram Reddy Gottimukkula Feel the fusion
Session Management Sample Application

---------------------------ramSession.cfm------------------------------------------------------------

<!---Sample Session Management Application --->
<!--- session timeout 10 sec --->
<cfapplication name = "#cgi.server_name#"
sessionmanagement = "yes"
sessiontimeout = "#CreateTimeSpan(0,0,10,0)#"
setclientcookies = "yes"
setdomaincookies = "yes">

<cfset appsessiontimeout=APPLICATION.GetApplicationSettings().sessiontimeout>
<cfdump var="#APPLICATION.GetApplicationSettings()#">
<cfset appsessiontimeout= appsessiontimeout/60>
<cfoutput>Minutes : #appsessiontimeout#</cfoutput>
<html>
<head>
<script type="text/javascript">
var appsessiontimeout=<cfoutput>#appsessiontimeout#</cfoutput>;
fnenableTimer();
function displayAlert()
{
alert("Your Application time Expired")
}
function fnenableTimer()
{
var manualtimeout_mili=appsessiontimeout * 1000;
global_warning =setTimeout("displayAlert()",manualtimeout_mili);
}
</script>
</head>
<body>
<form>
Write the logic here based on the session timeout(redirecting to Login etc..)
</form>
</body>
</html>
----------------------------------------

Mail me to raghuramgreddy@gmail.com for suggestions,queries.
Have a great day,

Thanks,
Raghuram Reddy.Gottimukkula
Adobe certified Coldfusion Developer
Bangalore
Special Thanks to Bharathi Raja

No comments:

Post a Comment