|
| Cookie expires after 30 mins when I set longer expiring time in my codes |
 |
Tue, 1 Apr 2008 05:37:11 +0000 |
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!
|
| Post Reply
|
| Re: Cookie expires after 30 mins when I set longer expiring time in my codes |
 |
Tue, 1 Apr 2008 07:28:32 +0000 |
why dont you change the valeu in web.config itself?
|
| Post Reply
|
| Re: Cookie expires after 30 mins when I set longer expiring time in my codes |
 |
Tue, 1 Apr 2008 07:49:25 +0000 |
to vik20000in:
because I want to allow users to custom their own expiring time of cookie.
|
| Post Reply
|
| Re: Cookie expires after 30 mins when I set longer expiring time in my codes |
 |
Tue, 1 Apr 2008 10:12:34 +0000 |
Is there more answers?
thanks
|
| Post Reply
|
| Re: Cookie expires after 30 mins when I set longer expiring time in my codes |
 |
Tue, 1 Apr 2008 10:24:57 +0000 |
Is there more answers?
thanks
|
| Post Reply
|
|
|
|
|
|
|
|
|
|