Hi Gurus, How can i Expire an Cookie data As I am storing the customer Cart data in the Request.Cookie("") Once the order is complete, how do I clear the cart contents from the cookie? Regards Sri
You can't physically remove the cookie - but you can set the cookie's expire date I would say - instead of using cookies, use sessions (which just store a session id in a cookie, not data in the cookie) - then you can flush this data anytime you want and it doesn't matter if the cookie still exists - it just has your session id.
Using expires property you can remove the cookies example myCookie.Expires = DateTime.Now.AddDays(1);
Be advised that, in some cases, expiring the cookie doesn't seem to work. This is because browsers like Chrome allow the browser to start up where it left off. And that means that any cookies that were active in the last session will still be active. This bit me a couple of times.