FormsAuthenticationTicket

Discussion in 'ASP .Net' started by Morgan, Dec 8, 2003.

  1. Morgan

    Morgan Guest

    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
     
    Morgan, Dec 8, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fresh Air Rider
    Replies:
    2
    Views:
    711
    Fresh Air Rider
    Feb 29, 2004
  2. Grey
    Replies:
    1
    Views:
    1,635
    John Saunders
    Jul 16, 2004
  3. Kiran B.
    Replies:
    5
    Views:
    4,479
    John Saunders
    Jan 4, 2005
  4. karunakar
    Replies:
    2
    Views:
    3,922
    Lau Lei Cheong
    Mar 15, 2005
  5. =?Utf-8?B?QW5kcmV3?=

    When to use FormsAuthenticationTicket()

    =?Utf-8?B?QW5kcmV3?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    9,771
    Brock Allen
    Dec 23, 2005
Loading...

Share This Page