Forms Auth Problems.

From: Ed Staffin (anonymous_at_discussions.microsoft.com)
Date: 04/23/04


Date: Fri, 23 Apr 2004 05:12:05 -0700

Hi, I am using the fairly standard code below to do my
forms authentication ticket and redirect, however, I am
finding that once successfully logged in, I don't get
another log after I close the browser. Is there something
I need to do to let it know that if the browser closes
they should be logged out?
Thanks ... Ed

Dim tkt As FormsAuthenticationTicket
Dim cookiestr As String
Dim ck As HttpCookie

tkt = New FormsAuthenticationTicket(1, txtUserName.Text,
      DateTime.Now(), DateTime.Now.AddMinutes(20),
      True, "")
cookiestr = FormsAuthentication.Encrypt(tkt)
ck = New HttpCookie( _
    FormsAuthentication.FormsCookieName(), cookiestr)
ck.Expires = tkt.Expiration
ck.Path = FormsAuthentication.FormsCookiePath()
Response.Cookies.Add(ck)
Resonse.Redirect(FormsAuthentication.GetRedirectUrl _
  (txtUserName.Text, False))



Relevant Pages

  • Re: how to make cookies into an array?
    ... Dim allCookies As New Generic.Dictionary(Of String, HttpCookie) ... Dim oneCookie As HttpCookie ... how can i retrieve the cookies? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: error: name Request is not declared
    ... The startpage of the application creates a httpCookie: ... Dim check As New HttpCookie ... name 'Request' is not declared. ... Public Shared Sub checkcookies ...
    (microsoft.public.dotnet.languages.vb)
  • Re: error: name Request is not declared
    ... The startpage of the application creates a httpCookie: ... Dim check As New HttpCookie ... name 'Request' is not declared. ... Public Shared Sub checkcookies ...
    (microsoft.public.dotnet.languages.vb)
  • error: name Request is not declared
    ... The startpage of the application creates a httpCookie: ... Dim check As New HttpCookie ... Public Shared Sub checkcookies() ...
    (microsoft.public.dotnet.languages.vb)