Skip to content

How to store the multiple values into cookie???

priya Avanigadda

Asked Oct 28, 2014, 11:25 PM EDT1 answer
Share
LinkedInX

I have very large website which uses a lot of cookies. There are approx. 14 different cookies are there. I have different cookies for each item. When a user surfs the site they will have 14 cookies in their browser. I do not want this.

I want a single cookie for my site that will have 14 items and I can add,edit and delete them. I tried many ways but I am not able to do this.

Can any body help me plllzzz...It's vry urgnt 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    You can do like
    HttpCookie cookie = new HttpCookie("Maincookie");
    cookie.Values.Add("id", "1");
    cookie.Values.Add("Name", "name");

    //get the values
     string id= Request.Cookies["Maincookie"]["id"];
     string Name= Request.Cookies["Maincookie"]["Name"];
    0