共用方式為


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)
    

適用於

另請參閱