Use this Script to logout and redirect to login page if user is idle for 5minutes.
Use this Script to logout and redirect to login page
if user is idle for 5minutes.
Keep this script code inside scripting tags.
var CurrentTime = 0; var TimeOut_Time = 300; var refreshIntervalId = setInterval(function () { CurrentTime = CurrentTime + 1; if (CurrentTime == TimeOut_Time) { location.href = '@Url.Content("~/Admin/Logout")'; clearInterval(refreshIntervalId); } }, 1000); $(document).mousemove(function (event) { CurrentTime = 0; }); $(document).keydown(function (event) { CurrentTime = 0; });
If anyone has more better way of achieving this functionality, please share.
Comments
Post a Comment