How can add/remove/replace LIST in cookies using C#.
//Declaring the List for image list
List<string> imageList = new List<string>();
foreach (FeaturedPromo promo in base.FeaturedPromos)
{
imageList.Add(promo.ImageHref);
}
In above code, I have got a list with all the Image HREF values in it, Now I want to add these values in cookies using C#, after that I can remove that item from cookies and also replace the value with other value of same item in cookies.
Please suggest!
Cookies are not removed they are just overwritten or expired (sometimes forced to expire).
To add it to cookies just create a Cookie Name Value collection and add each item from list to the Collection.
Example to add a list of items to cookies:
Example To Edit “item_2”
Example to delete cookies:
Example to delete a single item from list (just overwrite with nothing )
Note: But remember you can’t add too much data in cookies.. many browsers have a upper limit to the size and number of cookies you can store.