Author: JTP1987 | Posted on: 6/4/2008 11:04:05 AM | Views : 393

Hello...

When I am loggin in to my site I am using the following code:

Dim ticket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, UserName, DateTime.Now, DateTime.Now.AddMinutes(30), True, p.Roles, FormsAuthentication.FormsCookiePath)
            Dim hash As String = FormsAuthentication.Encrypt(ticket)
            Dim cookie As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, hash)

            ' Set the cookie's expiration time to the tickets expiration time
            If (ticket.IsPersistent) Then
                cookie.Expires = ticket.Expiration
            End If

            ' Add the cookie to the list for outgoing response
      ...

Go to the complete details ...