Selecting one value from a cookie
-
Hello! I'm having some trouble geting one value (and only one) from my cookie, and would realy appreciate some help. This is my code: HttpCookie UserCookie; UserCookie = new HttpCookie( "strUserID" ); UserCookie.Values.Add("group", "1"); UserCookie.Values.Add("sim", "2"); Response.Cookies.Add( UserCookie ); How do I get only "group"? Thanks! -- Evil geniuses for a better tomorrow --
-
Hello! I'm having some trouble geting one value (and only one) from my cookie, and would realy appreciate some help. This is my code: HttpCookie UserCookie; UserCookie = new HttpCookie( "strUserID" ); UserCookie.Values.Add("group", "1"); UserCookie.Values.Add("sim", "2"); Response.Cookies.Add( UserCookie ); How do I get only "group"? Thanks! -- Evil geniuses for a better tomorrow --
If you read the documentation for the
Response.Cookies
property (rather, theHttpCookieCollection
class thatResponse.Cookies
reflects), it should be obvious:string group = Response.Cookies["group"];
Microsoft MVP, Visual C# My Articles