forms authentication ticket expiration problem

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

  1. #1

    Default forms authentication ticket expiration problem

    I have set up forms based authentication according to the KB article
    ([url]http://support.microsoft.com/kb/308157/EN-US/[/url]) using the
    FormsAuthenticationTicket based method. I have the timeout parameter set to
    "2" in web.config, and also in the code that creates the ticket. When I
    refresh default.aspx after waiting 2 minutes, I should get bounced back to
    loginform.aspx, but it doesn't happen. Can anyone tell me why? Code below:

    From web.config:
    *************
    <authentication mode="Forms">
    <forms name="MyApp011" path="/" loginUrl="LoginForm.aspx"
    protection="All" timeout="2"></forms>
    </authentication>
    <authorization>
    <deny users="?" />
    </authorization>

    *************

    From loginform.aspx:
    ****************
    tkt = New FormsAuthenticationTicket(1, txtUserId.Value, DateTime.Now(), _
    DateTime.Now.AddMinutes(2), chkPersistCookie.Checked, "your
    custom data")
    cookiestr = FormsAuthentication.Encrypt(tkt)
    ck = New HttpCookie(FormsAuthentication.FormsCookieName(),
    cookiestr)
    If (chkPersistCookie.Checked) Then ck.Expires = tkt.Expiration
    ck.Path = FormsAuthentication.FormsCookiePath()
    Response.Cookies.Add(ck)
    ***************

    Any suggestions greatly appreciated.

    Tom
    tparks69 Guest

  2. Similar Questions and Discussions

    1. Forms Authentication Ticket isn't destroyed when logging out
      I am using forms authentication on my web application which requires users to log in to add content on their website. Upon loggin out, i used the...
    2. Basic Forms Authentication Expiration ?
      Yes. When the user is authenticated with FormsAuthentcation.RedirectFromLoginPage or with FormsAuthentication.SetAuthCookie, pass false to the...
    3. Forms Authentication Ticket Reissue
      When using Forms Authentication with the SlidingExpiration attribute set to 'true', the authentication ticket is reissued sometime after half of...
    4. forms based authentication - ticket not expiring
      I have set up forms based authentication according to the KB article (http://support.microsoft.com/kb/308157/EN-US/) using the...
    5. Authentication ticket, cookieless, forms authentication?
      Hi. I want to use Forms Authentication, cookieless. The issue is setting the Authentication Ticket without using cookies (!) That is, the...
  3. #2

    Default Re: forms authentication ticket expiration problem



    Try setting slidingExpiration="false" in the <forms ..>

    PL.


    "tparks69" <tparks69@discussions.microsoft.com> skrev i meddelandet news:93AF4BEE-A9DE-4353-BF9A-51324665F9F4@microsoft.com...
    >I have set up forms based authentication according to the KB article
    > ([url]http://support.microsoft.com/kb/308157/EN-US/[/url]) using the
    > FormsAuthenticationTicket based method. I have the timeout parameter set to
    > "2" in web.config, and also in the code that creates the ticket. When I
    > refresh default.aspx after waiting 2 minutes, I should get bounced back to
    > loginform.aspx, but it doesn't happen. Can anyone tell me why? Code below:
    >
    > From web.config:
    > *************
    > <authentication mode="Forms">
    > <forms name="MyApp011" path="/" loginUrl="LoginForm.aspx"
    > protection="All" timeout="2"></forms>
    > </authentication>
    > <authorization>
    > <deny users="?" />
    > </authorization>
    >
    > *************
    >
    > From loginform.aspx:
    > ****************
    > tkt = New FormsAuthenticationTicket(1, txtUserId.Value, DateTime.Now(), _
    > DateTime.Now.AddMinutes(2), chkPersistCookie.Checked, "your
    > custom data")
    > cookiestr = FormsAuthentication.Encrypt(tkt)
    > ck = New HttpCookie(FormsAuthentication.FormsCookieName(),
    > cookiestr)
    > If (chkPersistCookie.Checked) Then ck.Expires = tkt.Expiration
    > ck.Path = FormsAuthentication.FormsCookiePath()
    > Response.Cookies.Add(ck)
    > ***************
    >
    > Any suggestions greatly appreciated.
    >
    > Tom

    PL Guest

  4. #3

    Default Re: forms authentication ticket expiration problem

    That seems to have done it. Thanks!

    "PL" wrote:
    >
    >
    > Try setting slidingExpiration="false" in the <forms ..>
    >
    > PL.
    >
    >
    > "tparks69" <tparks69@discussions.microsoft.com> skrev i meddelandet news:93AF4BEE-A9DE-4353-BF9A-51324665F9F4@microsoft.com...
    > >I have set up forms based authentication according to the KB article
    > > ([url]http://support.microsoft.com/kb/308157/EN-US/[/url]) using the
    > > FormsAuthenticationTicket based method. I have the timeout parameter set to
    > > "2" in web.config, and also in the code that creates the ticket. When I
    > > refresh default.aspx after waiting 2 minutes, I should get bounced back to
    > > loginform.aspx, but it doesn't happen. Can anyone tell me why? Code below:
    > >
    > > From web.config:
    > > *************
    > > <authentication mode="Forms">
    > > <forms name="MyApp011" path="/" loginUrl="LoginForm.aspx"
    > > protection="All" timeout="2"></forms>
    > > </authentication>
    > > <authorization>
    > > <deny users="?" />
    > > </authorization>
    > >
    > > *************
    > >
    > > From loginform.aspx:
    > > ****************
    > > tkt = New FormsAuthenticationTicket(1, txtUserId.Value, DateTime.Now(), _
    > > DateTime.Now.AddMinutes(2), chkPersistCookie.Checked, "your
    > > custom data")
    > > cookiestr = FormsAuthentication.Encrypt(tkt)
    > > ck = New HttpCookie(FormsAuthentication.FormsCookieName(),
    > > cookiestr)
    > > If (chkPersistCookie.Checked) Then ck.Expires = tkt.Expiration
    > > ck.Path = FormsAuthentication.FormsCookiePath()
    > > Response.Cookies.Add(ck)
    > > ***************
    > >
    > > Any suggestions greatly appreciated.
    > >
    > > Tom
    >
    >
    >
    tparks69 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