问我在Web.cofig里设置Session的时间是600分钟,但过半小时就过期了?

wusiyin 2004-01-30 04:06:12
问我在Web.cofig里设置Session的时间是600分钟,但过半小时就过期了,请问这是怎么回事。
...全文
107 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xubinhui 2004-03-19
  • 打赏
  • 举报
回复
Session相关问题:
1.Session丢失情况?
一:有些杀病毒软件会去扫描您的Web.Config文件,那时Session肯定掉,这是微软的说法。
二:程序内部里有让Session掉失的代码,及服务器内存不足产生的。
三:程序有框架页面和跨域情况。
第一种解决办法是:使杀病毒软件屏蔽扫描Web.Config文件(程序运行时自己也不要去编辑它)
第二种是检查代码有无Session.Abandon()之类的。
第三种是在Window服务中将ASP.NET State Service 启动,【并设置Web.Web.config的sessionState|mode为StateServer】
还有一种情况是您用资源管理器打开的还是IE打开的。
最好用IE打开试试。
2.Session被串?
Seesion是存储在服务器端的,它是使用客户端和服务器端共享一个关键字,一般情况下客户端使用cookie,服务器用这个cookie来识别seesion,如果seesion存在客户,他的安全性就得不到保障。一般来说就不会把用户登陆信息存储在seesion中了

<sessionState
mode="InProc"//这里改为StateServer 【把进程内状态改为进程外状态】 注意要启动 aspnet_state 服务
stateConnectionString="tcpip=127.0.0.1:42424"
stateNetworkTimeout="600"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="true" //这里说明不需要存在客户端 ,改为false试试?
timeout="60"
/>
ga3ga3 2004-01-30
  • 打赏
  • 举报
回复
Session.TimeoutThe Timeout property specifies the time-out period assigned to the Session object for the application, in minutes. If the user does not refresh or request a page within the time-out period, the session ends.

Syntax
Session.Timeout [ = nMinutes]

Parameters
nMinutes
Specifies the number of minutes that a session can remain idle before the server terminates it automatically. The default is 10 minutes. Session.Timeout has no hard-coded limit. Most Web administrators set this property to 8 minutes. It should not be set higher than 20 minutes (except in special cases) because every open session is holding onto memory. It should also not be set lower than 4 minutes because clients rarely respond within that time resulting in a loss of session state.

照字面意思..好象不能设置超过20分钟和低于4分钟
dcogili 2004-01-30
  • 打赏
  • 举报
回复
你再设置一下IISde的时间.
shyboywjy0227 2004-01-30
  • 打赏
  • 举报
回复
你设置的是600,600好象表示的是秒。
你这里的600换算成分钟就是10分钟,半个小时当然就过期了。

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧