Forms authentication - seems to log out every once in a while.

M

Mufasa

In my website, we are using forms authentication. But every once in a while,
it will seem to log you out suddenly when your in the middle of doing
something.

In my login page, I do the following code once the person has logged in
successfully:



FormsAuthentication.Initialize()
'The AddMinutes determines how long the user will be logged
in after leaving
' the site if he doesn't log off.
Dim fat As FormsAuthenticationTicket = New
FormsAuthenticationTicket(1, tbUserID.Text, DateTime.Now, _
DateTime.Now.AddMinutes(30), True, lsRole,
FormsAuthentication.FormsCookiePath)
Response.Cookies.Add(New
HttpCookie(FormsAuthentication.FormsCookieName, _
FormsAuthentication.Encrypt(fat)))


Is there anything else I need to do or will this take care of it.

TIA - Jeff.
 
B

bruce barker

you need to update the cookie timeout on every page request, not just at
login.

-- bruce (sqlwork.com)
 
M

Mufasa

OK color me embarrassed.

How do I do that? Just the FormsAuthenticationTicket code and the add
cookies code?

TIA - ( a pretty embarrassed ) Jeff.
 

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

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top