At 12:42 PM 4/29/2004, Andrew wrote: >Hey everyone, I have a question about removing cookies in ASP. I'm building >a shopping cart system and currently if I want to remove a cookie, I just >set it to '0'. Is there a better way to do this? > >Can I expire only one cookie in a set? > >For example, if I want to keep this one: >Response.Cookies("cart")(item1) >and delete this one: >Response.Cookies("cart")(item2) > >I do this: >removeItem = Request("removeitem") >For each item in Response.Cookies("cart") > If Request.Cookies("cart")(item) = removeItem Then > Response.Cookies("cart")(item) = 0 > End If >Next Andrew... First off, you should use th Session Object or a DB backend to store your Cart Information. Storing this data in the cookie itself is not a very clean solution. Second, to expire a cookie you use the .Expires property. All you are doing with your solution is setting the cookie item to "zero". This might make your application ignore that item - but it's not "removing" the cookie. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/ref_vbom_resoccook.asp You can expire each item separately, if you really need to: Response.Cookies(cookie)(key).Expires = #Date# -- Anthony Baratta President Keyboard Jockeys "Conformity is the refuge of the unimaginative."