¥50 有人知道,在ASP.NET中为什么 SESSION 被清空的原因吗?

quchch 2003-04-19 01:10:41
我在web.config文件中设置如下片断:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false"
timeout="120"
/>
按理说应该是session值保持120分钟,但是实际情况是:session值保持的时间时长
时短,有时不到10分钟就丢了,没有在规定的时间内,这是什么原因?
能解决者出高分回报!!!
...全文
73 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
quchch 2003-04-22
  • 打赏
  • 举报
回复
machine.config没有听说过,能介绍一下此文件干嘛用的吗?
quchch 2003-04-20
  • 打赏
  • 举报
回复
what is the State Server?
saucer 2003-04-20
  • 打赏
  • 举报
回复
The link I provided above suggested some causes of session losses:

"....
1. Various attributes (for example, the memoryLimit attribute) have particular settings in the <processModel> section of the configuration file.
2. The Global.asax or the Web.config file was modified.
3. The Bin directory of the Web application was modified.
4. Virus scanning software touched some .config files
...."

you should look into your application carefully to see where the problems are

besides using a database to store session states, you can also use a State Server, or actually you can write all the session information into the ViewState or hidden controls
quchch 2003-04-20
  • 打赏
  • 举报
回复
thanks,but 真的只有用数据库存session变量一种方法吗?
saucer 2003-04-20
  • 打赏
  • 举报
回复
it is mainly due to application recycle, see

PRB: Session Data Is Lost When You Use ASP.NET InProc Session State Mode
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q324772

consider to use State Server or SQL Server to store session information
quchch 2003-04-20
  • 打赏
  • 举报
回复
IIS和web.config设的值必须一样吗?
另外我在网站根目录下只放置了web.config文件,是不是还需要其他的文件
如果需要其他文件,可不可以提供一下文件中的内容?谢谢谢谢!
Oldman 2003-04-20
  • 打赏
  • 举报
回复
把你的machine.config也改成120看看!
mujin 2003-04-20
  • 打赏
  • 举报
回复
学习中。。。
timmy3310 2003-04-20
  • 打赏
  • 举报
回复
what is the State Server?

ASP.Net提供了三种保存Session的办法,一种是InProc,也就是保存在本服务器,一种是SQL Server,将Session值保存在数据库Server,第三种就是State Server,把Session保存在单独的服务器上面。
gweidian 2003-04-19
  • 打赏
  • 举报
回复
是不是你的iis设置了timeout不是这个值啊?
fxmpch 2003-04-19
  • 打赏
  • 举报
回复
我想是这样吧,当生成项目时,SESSION可能清空了
onlinebingo 2003-04-19
  • 打赏
  • 举报
回复
也可以试着写进cookie阿
或者直接传不行吗?
wsnet 2003-04-19
  • 打赏
  • 举报
回复
阅过,学习了。
timmy3310 2003-04-19
  • 打赏
  • 举报
回复
请参考:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316148

62,046

社区成员

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

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

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

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