Manually created Cookie with UserData won't persist

Discussion in 'ASP .Net Security' started by mitch, Mar 4, 2004.

  1. mitch

    mitch Guest

    I'm manually creating a FormsAuthenticationTicket and adding userdata.
    The problem is that the cookie won't persist.

    Code:
    --------------------------------------------------------------------
    Dim isPersistent As Boolean = Remember.Checked
    Dim userData As String = "RecordNumber"

    Dim ticket As New FormsAuthenticationTicket(1,strEmail,System.DateTime.Now,System.DateTime.Now.AddMinutes
    (30),isPersistent,userData,FormsAuthentication.FormsCookiePath())

    ' Encrypt the ticket.
    Dim encTicket As String = FormsAuthentication.Encrypt(ticket)

    ' Create the cookie.
    Dim authCookie as New
    HttpCookie(FormsAuthentication.FormsCookieName(), encTicket)
    authCookie.Path = FormsAuthentication.FormsCookiePath()
    If isPersistent = True
    Then authCookie.Expires = DateTime.Now.AddYears(50)
    End If

    'Write the cookie
    Response.Cookies.Add(authCookie)
    ----------------------------------------------------------------------

    I have another application (same client/server setup) that uses:
    FormsAuthentication.RedirectFromLoginPage(Email.Text,
    Remember.Checked)
    and this cookie persists fine.....

    Using IE6 and W2K server.

    Thanks

    Mitch
    mitch, Mar 4, 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. BH
    Replies:
    2
    Views:
    602
  2. Dica
    Replies:
    1
    Views:
    400
    bruce barker
    Jun 20, 2007
  3. Replies:
    0
    Views:
    322
  4. musosdev

    .net 3.5 - DropDownList won't persist

    musosdev, May 28, 2009, in forum: ASP .Net
    Replies:
    5
    Views:
    1,223
    Norman Yuan
    May 29, 2009
  5. Richard  Lawrence

    HTTP::Cookie won't store sent cookie

    Richard Lawrence, Mar 17, 2005, in forum: Perl Misc
    Replies:
    4
    Views:
    181
    Richard Lawrence
    Mar 21, 2005
Loading...

Share This Page