如何在global.asax中使用会话超时 [英] how to use session time out in global.asax

查看:62
本文介绍了如何在global.asax中使用会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨....朋友

-i想给会话时间30分钟,以便在任何用户和管理员登录时都有效,然后在30分钟后他的会话将过期,需要重新登录,所以我该如何在global.asax中实现此任务?

-i这里关于Session_Start来执行此任务的方法正确吗????

hi....friends

-i want to give session time 30 minites so in any user and admin login and then after 30 minites his session is expire and need to relogin so how can i implement this task in global.asax

-i here about Session_Start to perform this task is it right way?????

推荐答案

您可以使用Web.Config文件来完成.有以下三种会话类型,您必须将以下部分添加到web.config

1)InProc
you can do using Web.Config file. there are three type of Session as below, you have to add below section into web.config

1)InProc
<sessionstate mode="InProc" cookieless="true" timeout="30" />


2)StateServer


2)StateServer

<sessionstate mode="StateServer" stateconnectionstring="tcpip=SampleStateServer:42424" cookieless="false" timeout="30" />


3)SQLServer


3)SQLServer

<sessionstate mode="SQLServer" sqlconnectionstring="Integrated Security=SSPI;data source=SampleSqlServer;" />



用户闲置30分钟后,会话将自动过期



session will expire automatically when user is idle for 30 min


在Web配置中尝试以下操作:
Try this one in web config:
<system.web>
    <sessionState timeout="60" />
</system.web>


这篇关于如何在global.asax中使用会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆