每次更改它的值时,ASP.Net会话的过期时间是否都会更新? [英] Do ASP.Net sessions expire time renews each time I change its values?

查看:66
本文介绍了每次更改它的值时,ASP.Net会话的过期时间是否都会更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我的会话将在5分钟后过期.如果4分钟后,我通过执行以下操作更改了其值:
会话[示例] = newObject;
能否将其过期时间重新设置为5分钟?

Lets say I have the session to expire in 5 minutes. If 4 minutes later I change its values by doing this:
Session["example] = newObject;
Will this reset its expire time back to 5 minutes?

推荐答案

否.您进行回发的事实会重置超时.如果您访问值,则没有什么区别,只要从服务器请求了页面即可.因此,您可以设置一个会话值,让某个人浏览一个小时,由于页面请求,该值仍将存在.
No. The fact you did a postback, resets the timeout. If you access the values makes no difference, so long as a page was requested from the server. So, you can set one session value, have someone browsing for an hour, and it will still be there, because of the page requests.


这篇关于每次更改它的值时,ASP.Net会话的过期时间是否都会更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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