Hi
I am wondering how do I set a timeout for a user if they don't do any requests after say 10mins there session is killed and they are logged out.
I have in my webconfig this
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn"
protection="All"
timeout="20160"
path="/"
requireSSL="false"
slidingExpiration="false"
defaultUrl="default.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false" />
</authentication>
I was told to set timeout to equal "20160" because I wanted to be logged in for 2 weeks if they checked the "stay logged in for 2 weeks". I also make sure to enable IsPersistent in my cookie Cookie.
So is there another timeout I need to set? Since after a certain time of inactivity on my site it does not work anymore. I have not timed it but say if I leave and come back 10mins later and try to do something on my site like saving something it won't work. So it looks like my connection was killed or something. I have to signout, log back in and then it works
Edit
This is how I make my cookie
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(version,userName,DateTime.UtcNow,DateTime.UtcNow.AddDays(14),createPersistentCookie,userData,"/");
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
authCookie.Path = "/";
if (createPersistentCookie == true)
{
authCookie.Expires = DateTime.UtcNow.AddDays(14);
}
HttpContext.Current.Response.Cookies.Add(authCookie);
When I do set session state in my webconfig my url has this in it
(S(gkvkze55zfzzee45wj34byee))
I rather not have this nasty line in my code.