Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > FormsAuth Ticket Keeps Expiring

Reply
Thread Tools

FormsAuth Ticket Keeps Expiring

 
 
George Durzi
Guest
Posts: n/a
 
      09-18-2003
Calling out ASP.NET Forms Auth Experts! I need your help.

Using FormsAuthentication to auth against Active Directory. During my login
process, I'm constructing a FormsAuthenticationTicket as follows:

FormsAuthenticationTicket oAuthTicket = new FormsAuthenticationTicket(1,
txtUserName.Value.Trim(), DateTime.Now, DateTime.Now.AddHours(, true,
sGroups);

Where:
- 1 is the version
- txtUserName.Value.Trim() holds the user name from the login screen
- DateTime.Now is the issue Date
- DateTime.Now.AddHours( is the expiration date
- true designates persistence
- sGroups is a "|" character separated string of groups of which the user is
a member of

I then encrypt the AuthenticationTicket then add it to the cookies
collection
string sTicket = FormsAuthentication.Encrypt(oAuthTicket);
HttpCookie oCookie = new HttpCookie(FormsAuthentication.FormsCookieName,
sTicket);
Response.Cookies.Add(oCookie);

In web.config, I also have the timeout set to 480 minutes. This overrides
whatever is set in machine.config.
<authentication mode="Forms">
<forms loginUrl="login.aspx" name="adAuthCookie" timeout="480" path="/"
/>
</authentication>

The problem is the users keep getting kicked out to the login screen in much
less than the set time of 480 minutes. I'm not deploying any updates to the
application during that time, so the Sessions aren't being reset, which I
know would cause the user to get kicked out.

Interesting thing though, when I do an oCookie.Expires, it gives me
01/01/2001, so the Expires property isn't being carried from the
FormsAuthenticationTicket.

However, the value of adAuthTicket.Expiration is always correct. (I'm
sticking it in a session for testing)



Can anyone explain this behaviour?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
authentication ticket expiring too soon bmjnine@hotmail.com ASP .Net Security 2 10-03-2006 11:15 PM
Two Different FormsAuth Logins for Same Application =?Utf-8?B?QWxleCBNYWdoZW4=?= ASP .Net 1 09-11-2006 02:12 PM
forms based authentication - ticket not expiring tparks69 ASP .Net Security 0 01-31-2005 09:03 PM
Form Authorization Ticket Not Expiring chongo ASP .Net 1 04-28-2004 03:53 AM
HELP: Cookie keeps expiring! VB Programmer ASP .Net 0 11-03-2003 02:58 PM



Advertisments