I'm trying to edit a login system using asp.net identity .I need a variable amount of time to expire different users session .I'm trying to expire users from controller and using something like this,
var authenticationProperties = new AuthenticationProperties()
{
ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(5)
};
authManager.SignIn(authenticationProperties,identity);
but when i try something for expiration time like 6 minutes or greater it doesn't expire but works for smaller amount of time like 1-5 minutes.what can be the possible causes ? and how can i fix this problem ? [i'm not an asp.net programmer so don't know details if anyone can suggest a good tutorial ,it will be very helpful thank you]
Try this code..
To limit cookie life set ExpireTimeSpan to an hour or second or minute in ConfigureAuth method in Startup.Auth.cs
public void ConfigureAuth(IAppBuilder app)
{
// other stuff
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
ExpireTimeSpan = TimeSpan.FromHours(1),
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.