forms based authentication - ticket not expiring

T

tparks69

I have set up forms based authentication according to the KB article
(http://support.microsoft.com/kb/308157/EN-US/) 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
login.aspx, but it doesn't happen. Selected code follows:

From web.config:
*************
<system.web>
<compilation defaultLanguage="vb" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Forms">
<forms name="AiraAdministrator" path="/" loginUrl="LoginForm.aspx"
protection="All" timeout="2"></forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="2" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
*************

From login.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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top