HttpCookie.HasKeys Property
.NET Framework 3.0
Gets a value indicating whether a cookie has subkeys.
Namespace: System.Web
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
The following code example examines each member of a cookie collection for multiple values. If a cookie's HasKeys property is true, indicating that multiple values are present, this example copies the value names into one string array and the corresponding values into another string array. For an example of how to create multiple values for a cookie, see Values.
HttpCookieCollection myCookieCollection = get_Request().get_Cookies();
for (int loop1 = 0; loop1 < myCookieCollection.get_Count(); loop1++) {
HttpCookie myCookie = myCookieCollection.get_Item(loop1);
if (myCookie.get_HasKeys()) {
NameValueCollection myCookieValues = new
NameValueCollection(myCookie.get_Values());
String myValueNames[] = myCookieValues.get_AllKeys();
String myValues[] = myCookieValues.get_AllKeys();
}
}
Community Additions
ADD
Show: