AnonymousIdentificationSection.CookieSlidingExpiration 属性

定义

获取或设置每次请求时是否重置 Cookie 超时值。

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

属性值

Boolean

如果启用可调过期,则为 true;否则为 false。 默认值为 false

属性

示例

下面的代码示例演示如何访问 CookieSlidingExpiration 属性。

// Get CookieSlidingExpiration.
bool cookieSlidingExpiration = 
    anonymousIdentificationSection.CookieSlidingExpiration;
Console.WriteLine("Cookie sliding expiration: {0}",
    cookieSlidingExpiration.ToString());
' Get CookieSlidingExpiration.
Dim cookieSlidingExpiration As Boolean = _
anonymousIdentificationSection.CookieSlidingExpiration
Console.WriteLine( _
"Cookie sliding expiration: {0}", _
cookieSlidingExpiration.ToString())

注解

如果 CookieSlidingExpiration 设置为 true 属性指定的 CookieTimeout 时间不到一半,则对于在单个会话期间发出的每个请求,Cookie 有效重置 CookieTimeout为的时间间隔。 false设置为时CookieSlidingExpiration,Cookie 将在设定的时间点过期。

适用于