Hello, every one I have one query on how to implement logic after 15 min user automatic logout without any activity for e.g(not fire any key and not clicking by mouse) in.net core
Loading
Hello, every one I have one query on how to implement logic after 15 min user automatic logout without any activity for e.g(not fire any key and not clicking by mouse) in.net core
Know the answer? Post it. Somebody with the same question will find it here.


Try this code
var idleTime = 0;
$(document).ready(function () {
//Increment the idle time counter every minute.
var idleInterval = setInterval(timerIncrement, 60000); // 1 minute
//Zero the idle timer on mouse movement.
$(this).mousemove(function (e) {
idleTime = 0;
});
$(this).keypress(function (e) {
idleTime = 0;
});
});
function timerIncrement() {
idleTime = idleTime + 1;
if (idleTime > 14) { // 15 minutes
window.location.reload();
}
}


Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Oct 27, 2021, 1:46 AM EDT