简体   繁体   English

如何使会话保持活动状态,直到用户未单击注销按钮

[英]how to keep session alive untill user does not click on logout button

i am creating asp.net website in this website i have managed sessions in various modules and i also change the web.config settings but the problems is that my session is expired automatically after hosting my website. 我正在该网站上创建asp.net网站,我已经在各种模块中管理了会话,并且还更改了web.config设置,但问题是托管我的网站后,我的会话会自动过期。 Its working fine on my local host but after hosting it session expired after some minutes. 它在我的本地主机上可以正常工作,但在托管会话后几分钟后到期。 i want to keep session alive for long time or until user does not click on logout button 我想长时间保持会话状态,或者直到用户未单击注销按钮

in my application i just want to calculate user login and logout time no matter user is using my application or not he just login when he come and logout at the time of leaving i just want some sample code that can send request to server in background and can keep session alive for all my pages (i have 8 master pages in my application) 在我的应用程序中,无论用户是否在使用我的应用程序,我都只想计算用户登录和注销时间,他只是来时登录并在离开时注销,我只想一些示例代码可以在后台将请求发送到服务器,可以使我所有页面的会话保持活动状态(我的应用程序中有8个母版页)

On page_load() event, store your session in a local variable. 在page_load()事件上,将会话存储在本地变量中。 like : 喜欢 :

 string sid = "";
sid = Sesion["id"];

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

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