Forms Auth Problems.

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Forms Auth Problems.

    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.GetRedirectUr l _
    (txtUserName.Text, False))

    Ed Staffin Guest

  2. Similar Questions and Discussions

    1. Forms Auth Info passed to Windows Auth?
      The requirement is to build an ASP.Net intranet application, so external users can log in to the main web portal via forms authentication, using...
    2. FORMS AUTH HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      I'm using forms Auth! Why am i getting the error:-I HAVE DONE EVRYTHING NEEDED! Error authenticating. Error obtaining group names. The specified...
    3. Help with forms auth
      Hi, I am using forms Auth on my WEB APP. I am checking the credentials in sql server. When a user request any page other than login.aspx they get...
    4. Forms Auth. What do you think?
      Hi guys, I am new to forms Authetication and wish to do the following.. A bit like the Dreamweaver Authentication tool... 1. Authenticate my...
    5. Configuring Windows Auth & Forms Auth in Asp.Net
      Configuring Windows Auth & Forms Auth in Asp.Ne Hi, I've configured a web app to use windows authentication and also set up two separate...
  3. #2

    Default Re: Forms Auth Problems.

    Your auth cookie can two options:
    a) it has no expiry date, in which case it is held in the browser's memory,
    and when the browser process is closed (all windows are closed), then the
    cookie is discarded.
    b) it has an expiry date (a persistant cookie), which is then written to
    disk, and returned to the server if the browser returns to that site (even
    if it has been closed)

    The server does not know when a user closes their browser - the browser
    doesn't send anything to every server that it's visited telling the server
    that the browser is being closed (that would be a huge privacy problem). So
    the server keeps the session going until it eventually timesout. However, if
    you:
    a) have a persistant cookie
    b) just close your browser
    c) open the browser again and point it to the side
    then
    a) the session is still going on the server
    b) the browser still has the cookie
    so you will be let in.

    You could use some client-side javascript code that pops-up a new window
    when the user attempts to close their browser. This new window would call a
    special page on the server that abandons the user's session. However pop-up
    blockers will block this from ever happening.

    Cheers
    Ken

    "Ed Staffin" <anonymous@discussions.microsoft.com> wrote in message
    news:338b01c4292c$315b1890$a401280a@phx.gbl...
    : 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.GetRedirectUr l _
    : (txtUserName.Text, False))
    :


    Ken Schaefer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139