forms authentication cookie not timeout

Discussion in 'ASP .Net Security' started by Daniel Jin, Nov 29, 2004.

  1. Daniel Jin

    Daniel Jin Guest

    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 ) );
     
    Daniel Jin, Nov 29, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Do
    Replies:
    2
    Views:
    6,430
  2. Sebastien Roeckel

    No cookie timeout in forms authentication

    Sebastien Roeckel, Dec 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    691
    Sebastien Roeckel
    Dec 10, 2003
  3. Eric
    Replies:
    2
    Views:
    1,544
    Tommy
    Feb 13, 2004
  4. rgouge

    Forms Authentication and Authentication Cookie

    rgouge, Jun 20, 2005, in forum: ASP .Net Security
    Replies:
    3
    Views:
    246
    Dominick Baier [DevelopMentor]
    Jun 20, 2005
  5. Eric
    Replies:
    2
    Views:
    607
Loading...

Share This Page