Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to remove an item from cookie

How to remove an item from cookie

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Khan Bangash
    wrote on last edited by
    #1

    Hi i m using asp.net with vb.net. I hv a cookie in which different items are stored. How can I removie a particular item from cookie. thanks in advance.

    N S M 3 Replies Last reply
    0
    • K Khan Bangash

      Hi i m using asp.net with vb.net. I hv a cookie in which different items are stored. How can I removie a particular item from cookie. thanks in advance.

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      You can't remove cookie. But you can set the expiry time of the cokie to a date which is less than today's date, and add that cookie again. Browser will think it's an expired cookie and will be removed.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      1 Reply Last reply
      0
      • K Khan Bangash

        Hi i m using asp.net with vb.net. I hv a cookie in which different items are stored. How can I removie a particular item from cookie. thanks in advance.

        S Offline
        S Offline
        Sun Rays
        wrote on last edited by
        #3

        Hi, u can check and modify as per yr wish. string[] cookies = Request.Cookies.AllKeys; foreach (string cookie in cookies) { Response.Cookies[cookie].Expires = DateTime.Now.AddDays(-1); }

        Thanks, Sun Rays Rate this post if you like answer.

        1 Reply Last reply
        0
        • K Khan Bangash

          Hi i m using asp.net with vb.net. I hv a cookie in which different items are stored. How can I removie a particular item from cookie. thanks in advance.

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          Bangashan wrote:

          I hv a cookie in which different items are stored

          How did you store those different items in a cookie? As a cookies can store only one the name and value pair, you can't create the multiple name/value pairs in a cookie. but if you are storing the comma seperated values (e.g. 1,2,3,..,i) then you can change the value ..

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups