当MVC4中的用户空闲时间为5分钟时,如何自动注销? [英] How to automatically logout when user idle time is 5 mins in MVC4?
本文介绍了当MVC4中的用户空闲时间为5分钟时,如何自动注销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何自动
FormsAuthentication.SignOut();
Session.RemoveAll();
return RedirectToAction("Login", "Home");
在MVC4项目中,用户空闲时间为5分钟是什么时候?
when user idle time is 5 mins in MVC4 project?
推荐答案
根据您对空闲的定义,看起来您可以同时使用FormsAuthentication类的/system.web.security.formsauthentication.timeout.aspx"rel =" nofollow> Timeout
属性.
Based on your definition of idle, looks like you can do it by using both SlidingExpiration
and Timeout
property of the FormsAuthentication
class.
将超时"设置为5分钟,并将"SlidingExpiration"设置为true,您应该一切顺利.
Set Timeout to 5 minutes and SlidingExpiration to true and you should be good to go.
这篇关于当MVC4中的用户空闲时间为5分钟时,如何自动注销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文