HttpClientHandler.CookieContainer 属性

定义

获取或设置用于通过处理程序存储服务器 Cookie 的 Cookie 容器。Gets or sets the cookie container used to store server cookies by the handler.

public:
 property System::Net::CookieContainer ^ CookieContainer { System::Net::CookieContainer ^ get(); void set(System::Net::CookieContainer ^ value); };
public System.Net.CookieContainer CookieContainer { get; set; }
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public System.Net.CookieContainer CookieContainer { get; set; }
member this.CookieContainer : System.Net.CookieContainer with get, set
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.CookieContainer : System.Net.CookieContainer with get, set
Public Property CookieContainer As CookieContainer

属性值

CookieContainer

用于通过处理程序存储服务器 Cookie 的 Cookie 容器。The cookie container used to store server cookies by the handler.

属性

注解

CookieContainer属性提供 CookieContainer 类的实例,该类包含与此处理程序关联的 cookie。The CookieContainer property provides an instance of the CookieContainer class that contains the cookies associated with this handler.

如果 UseCookies 属性为 true ,则 CookieContainer 属性表示用于存储服务器 cookie 的 cookie 容器。If the UseCookies property is true, the CookieContainer property represents the cookie container used to store the server cookies. 用户可以在使用此属性发送请求之前设置自定义 cookie。The user can set custom cookies before sending requests using this property. 如果该 UseCookies 属性为 false,并且用户将 cookie 添加到 CookieContainer ,则 cookie 会被忽略,并且不会发送到服务器。If the UseCookies property is false and the user adds cookies to CookieContainer, cookies are ignored and not sent to the server. 如果将设置 CookieContainer 为, null 将引发异常。Setting the CookieContainer to null will throw an exception.

适用于