Modifier

Partager via


RoleManagerSection.CookieSlidingExpiration Property

Definition

Gets or sets a value indicating whether the cookie that is used to cache role names will be reset periodically.

public:
 property bool CookieSlidingExpiration { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("cookieSlidingExpiration", DefaultValue=true)]
public bool CookieSlidingExpiration { get; set; }
[<System.Configuration.ConfigurationProperty("cookieSlidingExpiration", DefaultValue=true)>]
member this.CookieSlidingExpiration : bool with get, set
Public Property CookieSlidingExpiration As Boolean

Property Value

true if the role names cookie expiration date and time will be reset periodically; otherwise, false. The default is true.

Attributes

Examples

The following code example demonstrates how to use the CookieSlidingExpiration property. This code example is part of a larger example provided for the RoleManagerSection class.

// Display CookieSlidingExpiration property.
Console.WriteLine("CookieSlidingExpiration: {0}",
  configSection.CookieSlidingExpiration);
' Display CookieSlidingExpiration property.
Console.WriteLine("CookieSlidingExpiration: {0}", _
 configSection.CookieSlidingExpiration)

Remarks

You can specify whether the cookie that is used to cache role names is periodically reset or expired at a fixed point in time by using the cookieSlidingExpiration attribute in the Web.config file for your ASP.NET application. If true, the cookie expiration is initially set to the current date and time plus the CookieTimeout property, in minutes. While the user continues to actively use the ASP.NET application, the expiration date and time of the cookie is automatically refreshed, if there is less than half of the CookieTimeout remaining. The default is true.

Applies to