当我的站点处于空闲状态时,我想在asp.net中自动注销我的站点。 我使用身份验证在web.config中将sessiontimeout设置为“10分钟”。 例如:如果我的网站处于闲置状态9分钟,然后我使用mysite(即,使我的网站非活动模式为活动模式)。然后,计时器将不得不从新会话开始(例如它必须以0:0:0开始)。 如果我的会话超时(即超过10分钟)网站将不得不自动注销.. 请指导我?? 任何想法????如何在asp.net中10分钟后自动注销我的网站,在我的网站处于闲置状态?
0
A
回答
0
您可以使用表单身份验证并为您的目的设置会话超时。
<configuration>
<system.web>
<sessionState timeout="10"></sessionState>
</system.web>
</configuration>
这将使会话时间超出10分钟。如果任何请求在10分钟之前到来,那么它将再次增加(总共10分钟)。
更多详细信息
How to set session timeout in web.config
您可以使用slidingExpiration="false"
在你的web.config文件,如果你只婉10分钟。
根据MSDN
When the SlidingExpiration is set to true, the time interval during which the authentication
cookie is valid is reset to the expiration Timeout property value. This happens if the user
browses after half of the timeout has expired. For example, if you set an expiration of 20
minutes by using sliding expiration, a user can visit the site at 2:00 PM and receive a cookie
that is set to expire at 2:20 PM. The expiration is only updated if the user visits the site
after 2:10 PM. If the user visits the site at 2:09 PM, the cookie is not updated because half
of the expiration time has not passed. If the user then waits 12 minutes, visiting the site at
2:21 PM, the cookie will be expired.
0
很难明白你正在尝试做的。为什么这个问题用“javascript”和“ajax”标记?
会话状态不一定涉及表单身份验证。我本可以从您的网站发布一个持久性Cookie,并且无论您的网站保持闲置状态的时间长短都没有关系,我仍然可以向您的网站发送经过身份验证的请求...因为我拥有持久性Cookie。更重要的是,您甚至可以重新启动网站或您的应用程序池...我仍然不会从您的网站注销。
如果你想闲置10分钟后注销用户您的网站和您使用窗体身份验证,然后提出你的使用者,并在10分钟后过期饼干,见下文
<forms
timeout="10">
</forms>
例如WEB.CONFIG
如果你想“重置”过期值,然后使用在web.config中滑动过期这样
<forms
timeout="10"
slidingExpiration="true">
</forms>
您可以指定窗体身份验证有更多的价值。阅读MSDN文档...
http://msdn.microsoft.com/en-us/library/1d3t3c61(v=vs.85).aspx
我觉得你是一个有点糊涂。希望这个答案让事情更清楚一点我对你的朋友
利奥
0
相关问题
- 1. 我如何在PHP如果闲置10分钟,使用会话注销用户
- 2. SMF将我从我的网站注销
- 3. 当我从我的网站注销时,如何在我的网站中手动清除Facebook会话
- 4. 如何调试我的appengine网站处于脱机状态?
- 5. 来自ASP.NET网站的静态网站
- 6. 如何在社交网站2.1.3中从社交网站注销?
- 7. 注销我的网站,但不是Facebook
- 8. 如何在基于MVC的网站中处理状态消息?
- 9. 如何注销github网站?
- 10. 如何让我的网站在关闭浏览器时自动注销用户?
- 11. 在网站上注销?
- 12. 如何在我的网站
- 13. 我的网站需要10分钟来加载
- 14. 我如何版本我的asp.net网站?
- 15. 如何从我自己的网站更新Facebook的状态?
- 16. 如何识别我的网站/网页是否在用户的桌面上处于活动状态
- 17. 在我的网站中包含网站的一部分
- 18. 在Asp.Net MVC网站维护状态
- 19. 在我的网站
- 20. 在我的网站
- 21. 在我的网站
- 22. 如何注销登录我的网站的所有用户-php
- 23. 我如何在我的网站上形成动态导航
- 24. 如何在asp.net中向我的网站显示其他网站的RSS FEED?
- 25. 如何在我的ASP.NET网站中显示其他网站的RSS源?
- 26. 使用后端在我的网站中嵌入网站
- 27. Android浏览器注销ASP.NET网站
- 28. Visual Studio将我的本地IIS网站配置为ASP.NET网站
- 29. 我如何在JQM网站
- 30. 上传我的ASP.NET网站?
我明白谢谢 – PremKumar