EveryOne Min 脚本被调用
在我的 MVC 应用程序中,当我运行应用程序时,如果我没有在应用程序中进行任何更改,脚本就会工作,并在一分钟后进入登录页面(为了测试脚本,我默认设置了 -1 到
sessiontimeout
这样就很容易检查脚本是否工作),现在我的问题是当我继续在我的应用程序中工作时它也重定向到登录页面如何修改此脚本:
<script type="text/javascript">
function keepAlive() {
window.clearTimeout(window.sessionKeepAlive);
window.sessionKeepAlive = window.setTimeout( function() {
window.location.href = '<%= Url.Action( "LogOn", "Account" ) %>';
}, <%= (Session.Timeout - 19) * 60 * 1000 %>);
} keepAlive();
</script>
In my MVC application, when I run my application when I didn't do any changes in my application the scripts work and goes to the to login page after one min (to test the script I have default set -1
to the sessiontimeout
so it will be easy to check script working or not) , now my issue is when I contionusly go on working in my appication also it's redirecting to login page do how to modify this script:
<script type="text/javascript">
function keepAlive() {
window.clearTimeout(window.sessionKeepAlive);
window.sessionKeepAlive = window.setTimeout( function() {
window.location.href = '<%= Url.Action( "LogOn", "Account" ) %>';
}, <%= (Session.Timeout - 19) * 60 * 1000 %>);
} keepAlive();
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,典型的(默认)会话超时是 20 分钟,而您要减去 19 分钟...我认为您只需在此处减去
1
,这样您就会收到 60 秒的通知,因此:应该是:
Well, the typical (default) session timeout is 20 minutes, and you're subtracting 19...I think you want to just subtract
1
here so you get 60 seconds notice, so this:Should be: