Share via


CookieHandler.PersistentSessionLifetime 属性

定义

永久会话的生存期。 如果为零,将始终使用瞬变会话。

public:
 virtual property Nullable<TimeSpan> PersistentSessionLifetime { Nullable<TimeSpan> get(); void set(Nullable<TimeSpan> value); };
public virtual TimeSpan? PersistentSessionLifetime { get; set; }
member this.PersistentSessionLifetime : Nullable<TimeSpan> with get, set
Public Overridable Property PersistentSessionLifetime As Nullable(Of TimeSpan)

属性值

会话生存期。 默认值为 null

例外

指定的值小于零。

注解

持久会话的票证存储在基于文件的 Cookie 中,这意味着在关闭并重新打开 Web 浏览器后,登录会话可以继续。

此属性用于设置 HttpCookie.Expires 属性。

可以通过在配置中的 cookieHandler> 元素上<指定 persistentSessionLifetime 属性来初始化 属性。

适用于