【问题标题】:How can I know the idle time of asp.net application?我如何知道asp.net应用程序的空闲时间?
【发布时间】:2013-09-05 21:45:22
【问题描述】:
我在 asp.net 中有一个带有 Jquery 的应用程序。我想知道特定用户登录后应用程序的空闲时间。
Y = 15 分钟
如果用户 X 已登录,然后应用程序空闲 Y 分钟,那么我需要在最后 2 分钟后向他们显示计数器,您的应用程序将注销。
Y 分钟是可配置的用户明智的。我想从 Jquery 获得这个,并且我使用了表单身份验证。
谢谢,
【问题讨论】:
标签:
jquery
asp.net
session
forms-authentication
【解决方案1】:
怎么样:
var idleWarning;
$("body,html")
.bind("touchstart touchmove scroll mousedown DOMMouseScroll mousewheel keyup",
function(){
if(idleWarning){ cancelTimeOut(idleWarning); }
idleWarning = setTimeOut(function(){
alert("12 minutes idle");
}, 7200);
});