forms authentication cookie not timeout

D

Daniel Jin

I customized the cookie generation in forms authentication so I can keep
extra data in the cookie. but the problem now is that my forms
authentication cookie no longer times out. anybody knows what's going on?
the following is my code that creates the cookie.

string[] roleList = <custom method to get roles>;
string userData = String.Join( ";", roleList );

FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, userName, issueDate, issueDate.AddMinutes(1), false, userData,
FormsAuthentication.FormsCookiePath );

string encryptedTicket = FormsAuthentication.Encrypt( ticket );

HttpCookie cookie = new HttpCookie( FormsAuthentication.FormsCookieName,
encryptedTicket );
Response.Cookies.Add( cookie );

Response.Redirect( FormsAuthentication.GetRedirectUrl( userName, false ) );
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top