I am generating a FormsAuthentication Ticket on User Login based on Roles...but user automatically logs out within 1 minute
even though i have set timeout to 24 hours...but cookie still exists in the browser...... its working perfectly in localhost
My ticket code is:
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, UserName, DateTime.Now, DateTime.Now.AddMinutes(1440), false, Roles, FormsAuthentication.FormsCookiePath);
string hashcookies = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hashcookies); cookie.Expires = ticket.Expiration; Response.Cookies.Add(cookie);
My web.config settings are:
<forms name="AuthCookie" loginUrl="Login.aspx" defaultUrl="Default.aspx" timeout="1440"
slidingExpiration="true" protection="All" path="/"/>
<sessionState timeout="1440" mode="InProc"></sessionState> ...
Go to the complete details ...