MVC 5身份自动注销 [英] MVC 5 Identity Automatic Logout
本文介绍了MVC 5身份自动注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何实现自动注销定时器。
How do I implement an Automatic Logout Timer.
所以基本上,如果用户处于非活动状态x分钟的会议结束?
So basically if the user is inactive for x minutes their session is ended?
我曾尝试:
<system.web>
<sessionState timeout="1"/>
</system.web>
但它似乎并没有工作。
But it doesn't seem to work.
下面为code,它是我的启动:
Here is code that is in my startup:
public void ConfigureAuth(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
}
这表示,我使用Cookie身份验证。所以我DONO什么这就需要如果我能做到这一点。
Which says that I am using cookie Authentication. So i dono what that entails if I can do it or not.
推荐答案
它在 App_Start \\ Startup.Auth.cs
文件的属性:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
ExpireTimeSpan = TimeSpan.FromMinutes(5),
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
这篇关于MVC 5身份自动注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文