简体   繁体   English

我有一个混合(部分 ASP,部分 ASPX)Web 应用程序。 如果用户在 ASPX 端花费太长时间,他们将在 ASP 端注销。 我怎样才能解决这个问题?

[英]I have a hybrid (part ASP, part ASPX) web app. If the user spends too long on the ASPX side, they get logged out on the ASP side. How can I fix this?

If the user spends too long on the ASPX side of the app without visiting an ASP page, their ASP session times out and the next time they visit an ASP page, they get logged out and have to log in again.如果用户在应用程序的 ASPX 端花费太长时间而没有访问 ASP 页面,他们的 ASP 会话就会超时,并且下次他们访问 ASP 页面时,他们将被注销并必须重新登录。 Is there any way to count both sides of the app toward the logout timer?有没有办法将应用程序的双方都计入注销计时器? Rather than having a separate logout timer for each as we have now?而不是像我们现在那样为每个人设置一个单独的注销计时器?

As you have discovered Classic ASP and ASP.net have separate session objects, and it can be a pain.正如您所发现的,Classic ASP 和 ASP.net 具有单独的会话对象,这可能会很痛苦。 It's even more annoying if you want to share session variables.如果您想共享会话变量,那就更烦人了。 The default timeout for both is 20 minutes - you can specify other values if you wish.两者的默认超时时间为 20 分钟 - 如果您愿意,您可以指定其他值。

What I would do in your situation is to use zero size iframes.在您的情况下,我会做的是使用零大小的 iframe。 The best place to put one is in the .master template if your app has one.如果您的应用程序有一个,最好将其放在 .master 模板中。 The iframe would point to a classic asp page whose sole function is to keep the Classic ASP session live. iframe 将指向一个经典的 ASP 页面,其唯一功能是保持经典 ASP 会话的活动。 If necessary you could also do it the other way around and have iframes in your classic pages pointing to an asp.net script如有必要,您也可以反过来做,并在经典页面中使用 iframe 指向 asp.net 脚本

您可以调用一个函数而不是会话 cookie 来检查用户何时登录的数据库条目,如果用户已登录,则将当前登录计时器UPDATE为“现在”。

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

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