SessionState 超时永远不会触发
我做错了什么。 sessionState Timeout 永远不会触发,它只会在 24 小时后触发,我想让它在我的网页上 20 分钟内触发。在 web.config 中,我像这样处理会话状态:
<sessionState cookieless="false" mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
timeout="1" stateNetworkTimeout="1"/>
timeout="1" 是故意的,用于测试。 在代码中,我通过调用 Session.SessionID.ToString() 来检查我所在的会话
What am I doing wrong. The sessionState Timeout never fires,It only fires after 24 hours, I want to let it fire in 20 minutes on my webpage. In the web.config I handle the sessionstate like this:
<sessionState cookieless="false" mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
timeout="1" stateNetworkTimeout="1"/>
timeout="1" is on purpose, for testing.
And in the code I check on which session I am by calling Session.SessionID.ToString()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用
InProc
,则不需要stateConnectionString
、sqlConnectionString
和stateNetworkTimeout
。尝试删除这些,看看这是否如您所愿。if you're using
InProc
, you dont needstateConnectionString
,sqlConnectionString
andstateNetworkTimeout
. Try removing these, and see if this works as you'd like.SessionState Timeout 仅在会话状态模式为 InProc 时触发。
SessionState Timeout only fires when session state mode is InProc.
我发现如果我改变 cookieless=false ->确实,它有效,但现在 sessionid 显示在我的 URL 中。我怎样才能摆脱我的网址中的sessionid。
它就像 http://domain.com/(S(nvqmpm45j2fnnc21w00sjx55))/index.aspx
I've figured out that if I change cookieless=false -> true that it works , but now the sessionid is shown in my URL. How could I get rid of the sessionid in my url.
its like http://domain.com/(S(nvqmpm45j2fnnc21w00sjx55))/index.aspx