C# asp.net标识用户会话未使用authenticationProperties过期
我正在尝试使用asp.net标识编辑登录系统。我需要一段可变的时间使不同的用户会话过期。我正在尝试使controller中的用户过期,并使用类似的方法C# asp.net标识用户会话未使用authenticationProperties过期,c#,asp.net,asp.net-identity,C#,Asp.net,Asp.net Identity,我正在尝试使用asp.net标识编辑登录系统。我需要一段可变的时间使不同的用户会话过期。我正在尝试使controller中的用户过期,并使用类似的方法 var authenticationProperties = new AuthenticationProperties() { ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(5) }; aut
var authenticationProperties = new AuthenticationProperties()
{
ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(5)
};
authManager.SignIn(authenticationProperties,identity);
但是,当我尝试使用6分钟或更长的过期时间时,它不会过期,但在1-5分钟等更短的时间内有效。可能的原因是什么?及
我如何解决这个问题?
[我不是asp.net程序员,所以不知道详细信息如果有人能推荐一个好的教程,它将非常有用,谢谢]试试这段代码
在Startup.Auth.cs中的ConfigureAuth方法中将cookie寿命集ExpireTimeSpan限制为一小时、一秒或一分钟
public void ConfigureAuth(IAppBuilder app)
{
// other stuff
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
ExpireTimeSpan = TimeSpan.FromHours(1),
});
}
这是固定的1小时,但我需要不同用户的不同超时,因此我需要从控制器编辑过期时间。我可以使用“authenticationProperties”编辑吗?请尝试下面的链接。。设置身份验证代码后的过期时间。。。。。