如何在asp.net中设置会话过期时间(C#) [英] how can i set session expire time in asp.net(C#)

查看:76
本文介绍了如何在asp.net中设置会话过期时间(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨,,

嗨我有一个用于保存用户ID的会话,,,

i希望将此会话到期时间设置为15分钟...

我该怎么做?

解决方案

编辑Web.config文件...在System Web标签中写下这一行



< sessionstate timeout =   15 >  < /   sessionstate  >  





only ...


< configuration>

< system.web>

< sessionstate

mode =InProc

cookieless =true

timeout =30/>

< / sessionstate>< /system.web>

< / configuration>


  <  身份验证    mode   = 表单 >  
< 表格 loginUrl = 〜/ Account / Login timeout = 30 slidingExpiration = true / < span class =code-keyword>>
< / authentication >
< sessionState timeout = 30 > < ; / sessionState >

< / system.web >





通过

http://www.code-sample.com/2014/06/distinct-values-from-list-using-linq.html [ ^ ]


hi ,,
hi i have a session for saving User Id,,,
i want to set this session expire time to the 15 minutes...
how can i do this ??

解决方案

Edit the Web.config file ...In the System Web tag write this line

<sessionstate timeout="15"></sessionstate>



only...


<configuration>
<system.web>
<sessionstate
mode="InProc"
cookieless="true"
timeout="30" />
</sessionstate></system.web>
</configuration>


<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="30" slidingExpiration="true" />
</authentication>
<sessionState timeout="30"></sessionState>

</system.web>



By
http://www.code-sample.com/2014/06/distinct-values-from-list-using-linq.html[^]


这篇关于如何在asp.net中设置会话过期时间(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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