HttpCookie.Values 属性

定义

获取单个 Cookie 对象所包含的键值对的集合。

public:
 property System::Collections::Specialized::NameValueCollection ^ Values { System::Collections::Specialized::NameValueCollection ^ get(); };
public System.Collections.Specialized.NameValueCollection Values { get; }
member this.Values : System.Collections.Specialized.NameValueCollection
Public ReadOnly Property Values As NameValueCollection

属性值

NameValueCollection

Cookie 值的集合。

示例

下面的代码示例创建新的 Cookie,并为其添加多个值。 有关如何从一个 Cookie 中提取多个值的示例,请参阅 HasKeys

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

Dim MyCookie As HttpCookie = New HttpCookie("Cookie1")
 MyCookie.Values("Val1") = "1"
 MyCookie.Values("Val2") = "2"
 MyCookie.Values("Val3") = "3"
 Response.Cookies.Add(MyCookie)
    

适用于

另请参阅