Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpCookie.HttpCookie constructor

Initializes a new instance of the HttpCookie class with a specified name, domain, and path.

Syntax


var httpCookie = new Windows.Web.Http.HttpCookie(name, domain, path);

Parameters

name

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The name for the HttpCookie

domain

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The domain for which the HttpCookie is valid.

path

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The URIs to which the HttpCookie applies.

Remarks

The name parameter of the HttpCookie can't be set to null (Nothing in Visual Basic).

The property should be a token as defined in RFC 2616 and RFC 6265.

The following characters are used as separators and can't be used in the name parameter:

  • left paren ('(')
  • right paren (')')
  • greater than ('>')
  • less than ('<')
  • at sign ('@')
  • comma (',')
  • semicolon (';')
  • colon (':')
  • backslash ('\')
  • double quote ('"')
  • forward slash ('/')
  • left square bracket ('[')
  • right square bracket (']')
  • question mark ('?')
  • equal sign ('=')
  • left squiggly bracket ('{')
  • right squiggly bracket ('}')
  • new line ('\n')
  • return ('\r")
  • space (' ')
  • tab ('\t")

The domain parameter specifies those hosts to which the HttpCookie will be sent. A cookie with a domain parameter of .contoso.com will be sent to the contoso.com domain and all subdomains (www.contoso.com and info.contoso.com, for example).

A cookie with a domain parameter of info.contoso.com will not be sent to contoso.com or www.contoso.com, but will be sent to info.contoso.com and all subdomains (uk.info.contoso.com and us.info.contoso.com, for example).

If the domain parameter is not specified, then the HttpCookie will be sent only to the host and subdomains of the host that this cookie was received from.

The path parameter specifies the subset of paths on the origin server to which this HttpCookie applies. If this parameter is not specified, the default path matches any path and the HttpCookie will be sent on all HTTP requests to the domain parameter specified and all subdomains.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Web.Http
Windows::Web::Http [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http
Windows::Web::Http [C++]

Metadata

Windows.winmd

See also

HttpCookie

 

 

Show:
© 2015 Microsoft