Export (0) Print
Expand All

HttpCookie.Values Property

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

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public NameValueCollection Values { get; }
/** @property */
public NameValueCollection get_Values ()

public function get Values () : NameValueCollection

Property Value

A collection of cookie values.

The following code 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.

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

HttpCookie myCookie = new HttpCookie("Cookie1");

myCookie.get_Values().set_Item("Val1", "1");
myCookie.get_Values().set_Item("Val2", "2");
myCookie.get_Values().set_Item("Val3", "3");
get_Response().get_Cookies().Add(myCookie);

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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft