T
time is life
I use Forms Authentication in my web application, and use the following codes
to set the expire time of cookie to 3 days.
if( ValidateUser( txtUserName.Text , txtPassword.Text ))
{
HttpCookie
authenticationCookie=FormsAuthentication.GetAuthCookie(txtUserName.Text,true);
authenticationCookie.Expires=DateTime.Now.AddDays(3);//3天
Response.Cookies.Add(authenticationCookie);
Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUserName.Text,true));
}
but the actual result is: the cookie's expire time is still 30 mins which is
set in web.config instead of 3 days.
Why does this happen and how to solve it.
please help me , thank you very much!
to set the expire time of cookie to 3 days.
if( ValidateUser( txtUserName.Text , txtPassword.Text ))
{
HttpCookie
authenticationCookie=FormsAuthentication.GetAuthCookie(txtUserName.Text,true);
authenticationCookie.Expires=DateTime.Now.AddDays(3);//3天
Response.Cookies.Add(authenticationCookie);
Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUserName.Text,true));
}
but the actual result is: the cookie's expire time is still 30 mins which is
set in web.config instead of 3 days.
Why does this happen and how to solve it.
please help me , thank you very much!