FormsAuthenticationTicket

M

Morgan

Thanks in advance for any info...

Using web services, I am authenticating users and returning a valid
FormsAuthenticationTicket as a string, with an expiration of 20 minutes.
This is all fine and good. However, I would like to extend the expiration
each time the ticket is accessed. I found the
FormsAuthentication.RenewTicketIfOld method, but it won't allow me to
convert the string to a forms authentication ticket. Any ideas?

Private Function Login(...) as String
Dim ticket As New FormsAuthenticationTicket(userID, False, 1)
Dim encryptedTicket As String = FormsAuthentication.Encrypt(ticket)
'get the ticket timeout in minutes
Dim configurationAppSettings As AppSettingsReader = New AppSettingsReader()
Dim timeout As Integer =
CInt(configurationAppSettings.GetValue("AuthenticationTicket.Timeout",
GetType(Integer)))
'cache the ticket (timeout is 20)
Context.Cache.Insert(encryptedTicket, userID, Nothing,
DateTime.Now.AddMinutes(timeout), TimeSpan.Zero)
Return encryptedTicket
End Function

Thanks,

Morgan
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top