Web应用程序中的会话时间

问题描述:

假设用户登录了网站.
如果用户在一定时间内未触摸键盘和鼠标,则该用户的会话将被破坏.
我该如何使用ASP.net(c#)
请给我答案

Suppose the user log in a website.
If user does not touch the keyboard and mouse for a certain time, then the session is destroyed for that user.
How can i do this using ASP.net(c#)
Please give me the answer

设置会话超时属性或web.config中使用的机器密钥
set session timeout property or used machine key in web.config


<configuration>
  <sessionstate mode="inproc" timeout="20"/>
</configuration>




将此代码添加到配置标记内的Web配置文件中

10000是秒




add this code in web config file within configuration tag

10000 is seconds


转到web.config文件中的此部分

go to this section in web.config file

<session-config>
    <session-timeout>30</session-timeout>
  </session-config>