473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

login control persistent cookie problem

I'm using the 2.0 login control with the "remember me" setting. When
checked the cookie only last for a few hours then it is asking again for a
login. I don't see any time settings. I know back when we did our own
authentication we specified
FormsAuthentication.RedirectFromLoginPage(tbEmail. Text, True) and the cookie
lasted forever.

--
Regards,
Gary Blakely
Jul 7 '07 #1
4 3824
I'm using the 2.0 login control with the "remember me" setting. When
checked the cookie only last for a few hours then it is asking again for a
login. I don't see any time settings. I know back when we did our own
authentication we specified
FormsAuthentication.RedirectFromLoginPage(tbEmail. Text, True) and the
cookie lasted forever.
Well, it's similar way here.
However, even if it's 'RememberMe', it's not forever!

IIRC, it's a 3-step process in the Login control:

1. FormsAuthentication.SetAuthCookie(username, isRememberMeSelected)
In this, the timeout is set to DateTime.Now + TimeSpan.Parse(<forms
timeout="...">)
2. Raise the event LoggedIn
3. Response.Redirect(<redirect-from-login-page-url>)

In step1, the cookie is set with sliding-expiration (default) with the
timeout of 30 mins (default).
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Jul 9 '07 #2
Hi Gary,

From your description, you found that the "Login" control's "remember me"
setting doesn't work as expected(make the authentiation cookie
persisted),correct?

Based on my understanding, the Login Control's "RememberMe" property play
the same role as the second boolean parameter of the
FormsAuthentications.Authenticate(Or RedirectFromLoginPage) method. Here is
the diassembled code of the LoginControl from reflector:

========================
private void AttemptLogin()
{
if ((this.Page == null) || this.Page.IsValid)
{
LoginCancelEventArgs e = new LoginCancelEventArgs();
this.OnLoggingIn(e);
if (!e.Cancel)
{
AuthenticateEventArgs args2 = new AuthenticateEventArgs();
this.OnAuthenticate(args2);
if (args2.Authenticated)
{
FormsAuthentication.SetAuthCookie(this.UserNameInt ernal,
this.RememberMeSet);
this.OnLoggedIn(EventArgs.Empty);
this.Page.Response.Redirect(this.GetRedirectUrl(), false);
}
else
{
this.OnLoginError(EventArgs.Empty);
if (this.FailureAction ==
LoginFailureAction.RedirectToLoginPage)
{

FormsAuthentication.RedirectToLoginPage("loginfail ure=1");
}
ITextControl failureTextLabel = (ITextControl)
this.TemplateContainer.FailureTextLabel;
if (failureTextLabel != null)
{
failureTextLabel.Text = this.FailureText;
}
}
}
}
}
==========================

Also, for the authenticaiton ticket(cookie)'s timeout, as far as I know,
the only configuration option is in the web.config file's
<authentication>/<forms>/@timeout attribute. This controls the cookie's
timeout (when you use persistent cookie).

=============
<authentication mode="Windows">
<forms
...............
timeout="30"
.................>
........
</forms>
<passport redirectUrl="internal" />
</authentication>
==================

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 9 '07 #3
maybe we are miscommunicating...

I have several asp.net 1.1 apps that simply say:
FormsAuthentication.RedirectFromLoginPage(tbEmail. Text,
cbRememberMe.Checked)
and the cookie lasts forever. There is no timout setting in the web.config.
Iv'e doing this for years.

Persistent cookies are commonplace everywhere. My (any probably your)
amazon.com cookies last forever.

Maybe something has changed with the LoginControl.

--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:Ap**************@TK2MSFTNGHUB02.phx.gbl...
Hi Gary,

From your description, you found that the "Login" control's "remember me"
setting doesn't work as expected(make the authentiation cookie
persisted),correct?

Based on my understanding, the Login Control's "RememberMe" property play
the same role as the second boolean parameter of the
FormsAuthentications.Authenticate(Or RedirectFromLoginPage) method. Here
is
the diassembled code of the LoginControl from reflector:

========================
private void AttemptLogin()
{
if ((this.Page == null) || this.Page.IsValid)
{
LoginCancelEventArgs e = new LoginCancelEventArgs();
this.OnLoggingIn(e);
if (!e.Cancel)
{
AuthenticateEventArgs args2 = new AuthenticateEventArgs();
this.OnAuthenticate(args2);
if (args2.Authenticated)
{
FormsAuthentication.SetAuthCookie(this.UserNameInt ernal,
this.RememberMeSet);
this.OnLoggedIn(EventArgs.Empty);
this.Page.Response.Redirect(this.GetRedirectUrl(), false);
}
else
{
this.OnLoginError(EventArgs.Empty);
if (this.FailureAction ==
LoginFailureAction.RedirectToLoginPage)
{

FormsAuthentication.RedirectToLoginPage("loginfail ure=1");
}
ITextControl failureTextLabel = (ITextControl)
this.TemplateContainer.FailureTextLabel;
if (failureTextLabel != null)
{
failureTextLabel.Text = this.FailureText;
}
}
}
}
}
==========================

Also, for the authenticaiton ticket(cookie)'s timeout, as far as I know,
the only configuration option is in the web.config file's
<authentication>/<forms>/@timeout attribute. This controls the cookie's
timeout (when you use persistent cookie).

=============
<authentication mode="Windows">
<forms
...............
timeout="30"
.................>
........
</forms>
<passport redirectUrl="internal" />
</authentication>
==================

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 11 '07 #4
Thanks for your reply Gary,

Sorry that I haven't expected that you're using ASP.NET 1.1. Yes, the forms
authentication's ticket timeout does vary from 1.1 to 2.0. Actually the
change is mainly focus on persistent authentication cookie. In ASP.NET
1.x, the "timeout" setting in <formstag only affect non-persistent
authentication ticket, and in ASP.NET 2.0, this timeout setting affect both
persistent and non-persistent cookie. Here is a blog article (by scottgu)
which also explain this:

#Forms Authentication timeout default in ASP.NET 2.0
http://weblogs.asp.net/scottgu/archi...08/430011.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


Jul 13 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bryce21 | last post by:
I'm trying to write a script that logs into Yahoo Fantasy Football. Once logged in, I'll be able to grab stats and various other pieces of info about our league. The problem I'm having deals with...
0
by: konsu | last post by:
hello, i need to implement a secure web site in php and mysql but i have just started looking at php a few days ago, and i would appreciate any advice from the experts. the site, as i said,...
11
by: David W. Simmonds | last post by:
I have a form that will prompt for a user name/password. In VS.NET, I have the protected form in a folder named Admin. I have a Web.config file in that folder as well. It contains the following...
3
by: A.M | last post by:
Hi, I have implemented forms authentication on my application, but I have to fill the login form every time i run the web app during debugging phases. I know that i can change the code to...
0
by: Mach Runner | last post by:
I am implementing a secure website using the ASP.NET FormsAuthentication model. I have taken the simplest code examples from MSDN (login.aspx,default.aspx, web.config) but cannot get proper...
4
by: craigkenisston | last post by:
I have an asp.net application in which I sometimes store a persistent cookie once the user has logged in and this has been working great. However, I now add some user information like, username,...
3
by: Joe Fawcett | last post by:
Dear All We have an application where users login, their name/password details are stored in a table, and now we want to add a third party bulletin board that lives in its own virtual directory....
1
by: Ron | last post by:
I have an application that requires a login at each visit to the site and can only be accessed by a login. A user can have different themes depending if it was assigned in there profile. Theme...
1
by: jazzdrums | last post by:
Hello, we have migrated our website from .NET 1.1 to .NET 2.0. After this, some of our users are unable to log-on our site, while for the majority of them there's no problem. We're using a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.