By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Jun 4 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
you need to update the cookie timeout on every page request, not just at
login.

-- bruce (sqlwork.com)
Mufasa wrote:
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.

Jun 4 '07 #2

P: n/a
OK color me embarrassed.

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

TIA - ( a pretty embarrassed ) Jeff.

"bruce barker" <no****@nospam.comwrote in message
news:ut**************@TK2MSFTNGP05.phx.gbl...
you need to update the cookie timeout on every page request, not just at
login.

-- bruce (sqlwork.com)
Mufasa wrote:
>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.
Jun 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.