Compartir a través de


HttpCookie(String, String) Constructor

Definition

Constructs a cookie with a specified name and value.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;)V", "")]
public HttpCookie (string? name, string? value);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;)V", "")>]
new Java.Net.HttpCookie : string * string -> Java.Net.HttpCookie

Parameters

name
String

a String specifying the name of the cookie

value
String

a String specifying the value of the cookie

Attributes

Exceptions

if name is invalid.

Remarks

Constructs a cookie with a specified name and value.

The name must conform to RFC 2965. That means it can contain only ASCII alphanumeric characters and cannot contain commas, semicolons, or white space or begin with a $ character. The cookie's name cannot be changed after creation.

The value can be anything the server chooses to send. Its value is probably of interest only to the server. The cookie's value can be changed after creation with the setValue method.

By default, cookies are created according to the RFC 2965 cookie specification. The version can be changed with the setVersion method.

Java documentation for java.net.HttpCookie.HttpCookie(java.lang.String, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to