CookieHandler.RequireSsl 属性

定义

获取或设置一个值,该值指定是否应只用 SSL 验证 Cookie。Gets or sets a value that specifies whether the cookie should be used only with SSL.

public:
 virtual property bool RequireSsl { bool get(); void set(bool value); };
public virtual bool RequireSsl { get; set; }
member this.RequireSsl : bool with get, set
Public Overridable Property RequireSsl As Boolean

属性值

Boolean

如果只应针对 SSL 连接使用 cookie,则为 true ;否则为 falsetrue if the cookie should only be used over an SSL connection; otherwise, false. 默认值为 trueThe default is true.

注解

控制是否为写入的任何 cookie 发出 Set-Cookie 标头中的 "安全" 标志。Controls whether the "Secure" flag in the Set-Cookie header is emitted for any cookies written. 如果此值为 true ,则会话 cookie 仅可通过 HTTPS 使用。If this value is true, the session cookies will only be available over HTTPS.

此属性与属性相对应 HttpCookie.SecureThis property corresponds to the HttpCookie.Secure property.

可以通过 requireSSL 在配置中的 < cookieHandler > 元素上指定特性来初始化属性。The property can be initialized by specifying the requireSSL attribute on the <cookieHandler> element in configuration.

适用于