Click here to Skip to main content
14,869,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am making an eccomerce website where i have store data in cart using cookie.
I am easily store string variable but problem facing when storing image.

What I have tried:

HttpCookie userInfo = new HttpCookie("userInfo");
userInfo["image"] = Image1.ImageUrl;

userInfo["cakename"] = cakename.Text;
userInfo.Expires.Add(new TimeSpan(0, 1, 0));
Response.Cookies.Add(userInfo);
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Successfully Added to cart');", true);
Posted
Updated 11-Oct-18 2:13am
Comments
Mehdi Gholam 4-Oct-18 8:37am
   
Why store the image in a cookie?

1 solution

See the responses to this post[^]

Basically - don't store the image itself, store a link to it. Once the picture has been seen once the browser should cache it so there is minimal extra overhead.
   

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