What are the differences between
Request.Cookies["MyCookie"].Value
Request.Cookies["MyCookie"].Values
??
What are the differences between
Request.Cookies["MyCookie"].Value
Request.Cookies["MyCookie"].Values
??
A cookie can have more than one value, the second form returns a NameValueCollection with multiple values.
A good introduction is at http://msdn.microsoft.com/en-us/library/ms178194.aspx
Values is a NameValueCollection enabling you to do:
HttpCookie MyCookie = new HttpCookie("MyCookie");
MyCookie.Values["Value1"] = "1";
MyCookie.Values["Value2"] = "2";
MyCookie.Values["Value3"] = "3";
MyCookie.Values["Value4"] = "4";
Response.Cookies.Add(MyCookie);
Where as value allows you to assign the value of the individual cookie like this:
MyCookie.Value = "123";
Cookies["name"].Value is to check if cookie is null or not. Null is the value if the cookie was never set. Otherwise it gives you the cookie value (no subkeys) Cookies["name].Values is a subkey=>value pair of the values stored in the cookie.