How To Delete A Cookie?

Results 1 to 3 of 3

Thread: How To Delete A Cookie?

  1. #1
    Join Date
    Dec 1969

    Default How To Delete A Cookie?

    Hello Everyone,<BR>My name is Peter. I have some problems about cookies in ASP. Please give me a hand. It would be greatly appreciated!<BR><BR>First, I create cookies like this:<BR>&#060;%<BR>Dim ISBN1, quantity <BR>ISBN1 = cstr(Request("myHidden")) <BR>Response.Cookies("AddToCartCookie")(ISBN1) = quantity<BR>%&#062;<BR><BR>Then I try to delete that cookie like this:<BR>&#060;%<BR>Dim ISBN1, quantity <BR>ISBN1 = cstr(Request("myHidden"))<BR>Response.Cookies("Add ToCartCookie")(ISBN1)= 0<BR>%&#062;<BR><BR><BR>But it doesn’t work! If it were right, after the Delete button is click, that recordset will be disappeared and the quantity in the Shopping Cart will be decreased by 1. But when I try to delete, the record is still there. One thing changed is quantity = 0.<BR>Would you please show me what are wrong and how to fix that.<BR><BR>Please give me a hand. It would be greatly appreciated.<BR>I am looking forward to hearing from everyone.<BR><BR>Best regards,<BR>Peter<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default look in the cookie jar

    Response.Cookies("AddToCartCookie")=&#039;&#039;<B R><BR>Will set the cookie AddToCartCookie to nothing. <BR><BR>But here:<BR>&#060;%<BR>Dim ISBN1, quantity <BR>ISBN1 = cstr(Request("myHidden")) <BR>Response.Cookies("AddToCartCookie")(ISBN1) = quantity<BR>%&#062;<BR> <BR>Where do you request the number for quanity?<BR><BR>If I do this, your code works...not sure for what.<BR><BR>&#060;%<BR>Dim ISBN1, quantity <BR>quantity = 5<BR>ISBN1 = cstr(Request("myHidden")) <BR>Response.Cookies("AddToCartCookie")("sdfsf") = quantity<BR>%&#062;<BR><BR><BR><BR><BR>Check out the FAQs on this site about cookies. The FAQS are a lifesaver.<BR><BR><BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Ummm...changes to cookies...

    ...made via Response.Cookies, can NOT be seen until the NEXT page. You aren&#039;t showing us enough code to judge when you are setting and then checking the cookie.<BR><BR>And you can&#039;t DELETE a cookie by setting it to zero. You just changed its value to zero. That doesn&#039;t delete it. To delete it, you "expire" it. See the docs for how to do that.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts