SessionState 超时永远不会触发

发布于 2024-10-04 08:38:33 字数 427 浏览 0 评论 0原文

我做错了什么。 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

扶醉桌前 2024-10-11 08:38:33

如果您使用 InProc,则不需要 stateConnectionStringsqlConnectionStringstateNetworkTimeout。尝试删除这些,看看这是否如您所愿。

if you're using InProc, you dont need stateConnectionString, sqlConnectionString and stateNetworkTimeout. Try removing these, and see if this works as you'd like.

等往事风中吹 2024-10-11 08:38:33

SessionState Timeout 仅在会话状态模式为 InProc 时触发。

SessionState Timeout only fires when session state mode is InProc.

很酷又爱笑 2024-10-11 08:38:33

我发现如果我改变 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文