Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Values Property

HttpCookie.Values Property

Gets a collection of key-and-value value pairs that are contained within a single cookie object.

[Visual Basic]
Public ReadOnly Property Values As NameValueCollection
public NameValueCollection Values {get;}
public: __property NameValueCollection* get_Values();
public function get Values() : NameValueCollection;

Property Value

A collection of cookie values.


The following example creates a new cookie and adds several values to it. For an example of how to extract multiple values from one cookie, see HasKeys.

[Visual Basic] 
Dim MyCookie As HttpCookie = New HttpCookie("Cookie1")
 MyCookie.Values("Val1") = "1"
 MyCookie.Values("Val2") = "2"
 MyCookie.Values("Val3") = "3"

HttpCookie MyCookie = new HttpCookie("Cookie1");
 MyCookie.Values["Val1"] = "1";
 MyCookie.Values["Val2"] = "2";
 MyCookie.Values["Val3"] = "3";

HttpCookie* MyCookie = new HttpCookie(S"Cookie1");
 MyCookie->Values->Item[S"Val1"] = S"1";
 MyCookie->Values->Item[S"Val2"] = S"2";
 MyCookie->Values->Item[S"Val3"] = S"3";

var myCookie : HttpCookie = new HttpCookie("Cookie1")
myCookie.Values["Val1"] = "1"
myCookie.Values["Val2"] = "2"
myCookie.Values["Val3"] = "3"


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpCookie Class | HttpCookie Members | System.Web Namespace

© 2015 Microsoft