I am using the built-in Identity framework offered by the MVC template in VS2013 .NET Framework 4.5.1.
I am using the feature more or less out of the box. It has been working fine. Compared to other posts I have read, my web.config has:
<authentication mode="None" />
How do I set a time out period for authenticated sessions, that is, after the user has logged in?
The Forms Authentication Timeout value sets the amount of time in minutes that the authentication cookie is set to be valid, meaning, that after value number of minutes, the cookie will expire and the user will no longer be authenticated—they will be redirected to the login page automatically.
“OWASP recommends application builders to implement short idle time outs (2-5 minutes) for applications that handle high-risk data, like financial information. It considers that longer idle time outs (15-30 minutes) are acceptable for low-risk applications.”
If your Internet connection is unstable, periodically disconnecting and reconnecting, it can cause a website session to expire. When the Internet connection is lost the website connection can be terminated, resulting in a session expired message if you try to access any page after the Internet reconnects.
Idle Session Timeout. The Idle Session Timeout configures the time intervals that the management sessions can remain idle before they timeout and you must log in again to reestablish one of the following sessions: • HTTP Session Timeout.
If you are using Owin authentication, you should have something like this on your StartUp.cs
file within the App_Start
folder:
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
// here you go
ExpireTimeSpan = new TimeSpan(60000000000)
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With