Setting Cookie Properties

Cookies are represented with the HttpCookie class. When you create or read a cookie, you can use any of the properties of this class:

Domain Enables you to specify the domain associated with the cookie. The default value is the current domain.

Expires Enables you to create a persistent cookie by specifying an expiration date.

HasKeys Enables you to determine whether a cookie is a multi-valued cookie (see the section “Working with Multivalued Cookies” later in this chapter).

HttpOnly Enables you to prevent a cookie from being accessed by JavaScript.

Name Enables you to specify a name for a cookie.

Path Enables you to specify the path associated with a cookie. The default value is /.

Secure Enables ...

Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.