Vishwas Lele's WebLog

Fleeting thoughts...

Tags

No tags have been created or used yet.

December 2004 - Posts

New FormsAuthentication & Cookie Persistence

Why are there multiple ways to set cookie peristence for ASP.NET Forms authentication? Each of the following related methods [1] allows you affect the cookie expiration period.

FormsAuthenticationTicket Constructor

FormsAuthentication.GetRedirectUrl Method
  

HttpCookie.Expires Property

[1] For example, consider the following sequence of related operations:

Create an authentication ticket (FormsAuthenticationTicket)

Derive a cookie from the ticket (FormsAuthentication.Encrypt)

Get the redirect URL (FormsAuthentication.GetRedirectUrl)

Set the cookie (Response.Cookies.Add(cookie) )

More Posts