BasicHttpBinding.AllowCookies BasicHttpBinding.AllowCookies BasicHttpBinding.AllowCookies BasicHttpBinding.AllowCookies Property


获取或设置一个值,该值指示客户端是否接受 Cookie 并根据今后的请求传播 Cookie。Gets or sets a value that indicates whether the client accepts cookies and propagates them on future requests.

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


如果接受 Cookie,则为 true;否则为 falsetrue if cookies are allowed; otherwise, false. 默认值为 falseThe default is false.


以下示例设置此属性以指示应将服务器中的所有 cookie 都复制到今后的客户端请求:The following example sets this property to indicate that all cookies from the server should be copied to future client requests:

BasicHttpBinding binding = new BasicHttpBinding();
binding.AllowCookies = true;

也可以在配置文件中设置此属性的值。The value of this property can also be set in the configuration file.


提供此属性是为了便于与使用 Cookie 的 ASMX Web 服务进行交互。This property is provided as a convenience for interacting with ASMX Web services that use cookies. 如果客户端通过将属性设置为 true 接受 Cookie,则从服务器返回的 Cookie 会复制到今后对该服务发出的所有客户端请求。When cookies are accepted by the client by setting the property to true, cookies returned from the server are automatically copied to all future client requests to that service.