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
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