简体   繁体   English

如何同步JS超时和ASP.NET会话超时?

[英]how can I sync JS timeout and ASP.NET session timeout?

Ok. 好。 I can't really solve what I want - so if you can please advise me on how to: 我无法真正解决我想要的问题-因此,如果可以的话,请为我提供以下建议:

I have a page of each every click has ajax call to my server (hence, the ASP extends the session) 我的每个点击页面都有一个对我的服务器的ajax调用(因此,ASP扩展了会话)

I have ASP.NET session set to Xmin. 我将ASP.NET会话设置为Xmin。 I want when X+1 min expires, I have expiration page. 我想X + 1分钟过期时,我有过期页面。 what I did was to set the JS timer to validate every x+1min to see if the session expired (the problem is that the JS and the ASP session timeouts are not synced) 我要做的是设置JS计时器以每隔x + 1分钟验证一次会话是否过期(问题是JS和ASP会话超时未同步)

how can I make them be synced? 如何使它们同步?

every time you make an ajax call reset your timeout agian. 每次您进行ajax调用时,都要重置超时agian。 so they will be synced... 因此它们将被同步...

I say that you can not absolute synchronized them because they run on 2 different computer that you can not control the one of them. 我说您不能绝对同步它们,因为它们运行在2台无法控制其中一台的计算机上。 So is better find other way to do what you try. 因此,最好找到其他方法来做您尝试做的事情。

Here are similar links. 这是类似的链接。

http://forums.asp.net/p/1207721/3094847.aspx http://forums.asp.net/p/1207721/3094847.aspx

http://blogs.msdn.com/b/nikhiln/archive/2007/06/21/detecting-session-timeout-in-asp-net-2-0-web-applications.aspx http://blogs.msdn.com/b/nikhiln/archive/2007/06/21/detecting-session-timeout-in-asp-net-2-0-web-applications.aspx

http://www.codeproject.com/KB/scripting/Session_Timeout.aspx http://www.codeproject.com/KB/scripting/Session_Timeout.aspx

Get ASP.NET Session Last Access Time (or Time-to-Timeout) 获取ASP.NET会话的上次访问时间(或超时时间)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM