Click here to Skip to main content
14,836,552 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i store the values to in following manner
HttpCookie UserCookieN = new HttpCookie("userInfo");
           UserCookieN.Values["FrmType"] = Convert.ToString(Session["FrmType"]);
           UserCookieN.Values["UserId"] = Convert.ToString(UserId);
           UserCookieN.Values["BusId"] = Convert.ToString(BusId);
           UserCookieN.Values["FY"] = Convert.ToString(DdlFY.SelectedValue);
           UserCookieN.Values["RetType"] = Convert.ToString(DdlRetType.SelectedValue);
           UserCookieN.Values["NatRet"] = Convert.ToString(DdlNatRet.SelectedValue);
           UserCookieN.Values["Period"] = Convert.ToString(DdlPeriod.SelectedValue);
           UserCookieN.Expires = DateTime.Now.AddYears(30);

Now for specific "FrmType" there are multiple values of UserId,BusId,FY,RetType,NatRet,Period

At time retrieving values i want to get the values for that FrmType
Updated 12-Jul-11 20:30pm

1 solution

I thought a cookie always stores a string. If this is not true, then it's still the case that storing a string that tells you how to build your different objects seems like the smartest way to go. Or store two values, one telling you the type, the other telling you the data to cast to that type.
Member 7959293 13-Jul-11 3:39am
please see updated question and suggest ans
Sergey Alexandrovich Kryukov 13-Jul-11 13:09pm
Good idea about storing the type name. The object could be instantiated automatically used reflection. This is how serialization and Data Contract work. One can put a whole serialized object graph in the form of XML in one cookie value and work with it. A 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900