且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用户不活动时如何结束会话

更新时间:2023-12-04 19:34:52

当用户单击注销按钮时,
在该按钮中单击事件
清除所有cookie并写
When User click on Logout button,
in that button click event
clear all cookies and write
session.abandon();



在web.config中,在
标签下面写



In web.config write below tag in

<system.web> tag
<sessionstate timeout="60" /></system.web>



如果您使用表单身份验证,则可以设置
表单标签的



If you are using forms authentication then you can set

slidingExpiration

属性为

"true"



请通过这些链接

http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.slidingexpiration.aspx [ ^ ]

http://msdn.microsoft.com/en-us/library/1d3t3c61.aspx [ ^ ]



Please go through these links

http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.slidingexpiration.aspx[^]

http://msdn.microsoft.com/en-us/library/1d3t3c61.aspx[^]


您好,


您必须遵循一些流程.

让我告诉您我在客户端聊天应用程序中的表现如何

首先,我创建了3分钟超时的会话变量

然后在我的JavaScript中,我有一种方法可以在每个
中将数据从客户端发布到服务器 1分钟

在我的服务器端,我有一种方法可以处理异步请求,以扩展会话变量的时间.

在此过程中,客户端javascript每1分钟调用一次服务器方法
如果不是,则表示客户端未处于活动状态,则会话会自动
超时超时后清除

通过此过程,我在客户端网站上实现了我的聊天应用.

在这里我只说了示例时间以进行解释

您可以根据需要设置会话变量的超时时间

我希望你能理解我说的话

***的
Hi,


you''ve to follow some process for it.

Let me tell you how I did in my client chat app

First I created session variable with 3 min timeout

then in my javascript i''ve one method to post data from client to server in every
1 min

In my server side i''ve one method to handle that asyncronous request to extend timout of session variable.

In this process the server method invoked by client javascript in every 1 min
If not that means the client is no active then the session is automatically
cleared when its timeout time overs

By this process I achieve my chat app in client website.

Here I just said example timings for explanation

you can set timeouts of session variables As your requirement

I hope you understood What I said

All the Best