Provides a set of properties and methods to manage an HTTP cookie.
public : sealed class HttpCookie : IStringable
struct winrt::Windows::Web::Http::HttpCookie : IStringable
public sealed class HttpCookie : IStringable
Public NotInheritable Class HttpCookie Implements IStringable
var httpCookie = new httpCookie(name, domain, path);
Windows 10 requirements
Windows 10 (introduced v10.0.10240.0)
Windows.Foundation.UniversalApiContract (introduced v1)
Cookies are small chunks of data that are passed between HTTP servers and clients. Their primary use is by the web server developers to save session state. The web server developer uses the state to correlate earlier and later requests. For example, session state can include a unique visitor id which is then used to remember (on the server side) the visitor’s shopping cart.
The HTTP server sends cookies to the client with the Set-Cookie header. The client sends them back with the Cookie header. Cookies that are sent back don’t include cookie attributes. The correct cookie usage is that the server sets a cookie once and doesn’t re-set it on subsequent responses. This works because a cookie, once set, will be sent back until it expires or is deleted (as long as it matches the URI correctly). Cookies are persistent when they have a valid Expires header. Cookies that are not persistent are session cookies, and are not persisted from one session to another.
Although cookies are commonly used by web services developers, they are sometimes used by client-side developers.
|HttpCookie(String, String, String) HttpCookie(String, String, String) HttpCookie(String, String, String) HttpCookie(String, String, String) HttpCookie(String, String, String)||
Initializes a new instance of the HttpCookie class with a specified name, domain, and path.
|Domain Domain Domain Domain Domain||
Get the domain for which the HttpCookie is valid.
|Expires Expires Expires Expires Expires||
Get or set the expiration date and time for the HttpCookie.
|HttpOnly HttpOnly HttpOnly HttpOnly HttpOnly||
Get or set a value that controls whether a script or other active content can access this HttpCookie.
|Name Name Name Name Name||
Get the token that represents the HttpCookie name.
|Path Path Path Path Path||
Get the URI path component to which the HttpCookie applies.
|Secure Secure Secure Secure Secure||
Get or set the security level for the HttpCookie.
|Value Value Value Value Value||
Get or set the value for the HttpCookie.
|ToString() ToString() ToString() ToString() ToString()||
Returns a string that represents the current HttpCookie object.