Re: Cookie expires after 30 mins when I set longer expiring time..
- From: Dominick Baier <dbaier@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 2 Apr 2008 05:00:13 +0000 (UTC)
Have a look at the source of FormsAuthenticationModule - i might be wrong (too long ago) - but i think you will find the answer there.
-----
Dominick Baier (http://www.leastprivilege.com)
Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)
to Dominick Baier:
Because I want to allow users to custom the expiring time of their
cookie.
"Dominick Baier" wrote:
The expiration time gets regularly overwritten bei the
FormsAuthModule - why don't use set this in the config element?
-----
Dominick Baier (http://www.leastprivilege.com)
Developing More Secure Microsoft ASP.NET 2.0 Applications
(http://www.microsoft.com/mspress/books/9989.asp)
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.T
ex
t,true);
authenticationCookie.Expires=DateTime.Now.AddDays(3);//3天
Response.Cookies.Add(authenticationCookie);
Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUserName.Tex
t,
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!
.
- References:
- Re: Cookie expires after 30 mins when I set longer expiring time..
- From: time is life
- Re: Cookie expires after 30 mins when I set longer expiring time..
- Prev by Date: Re: Cookie expires after 30 mins when I set longer expiring time..
- Next by Date: Create MailBox Exchange Server ASP.net
- Previous by thread: Re: Cookie expires after 30 mins when I set longer expiring time..
- Next by thread: ASP.net websetup insists on using Membership provider
- Index(es):
Relevant Pages
|
|