Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can I control Timer in C# web app? say my session expires and I have to redirect to login page in 10 secs. thanks..
Posted

1 solution

JavaScript
var t;
window.onload=resetTimer;
document.onkeypress=resetTimer;

function logout()
{
	alert("You are now logged out.")
	location.href='Logoff.aspx' 
}
function resetTimer()
{
	clearTimeout(t);
	t=setTimeout(logout,10000) //logs out in ten secs
}


try this
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900