Reg:Cookies

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vinoth82
    New Member
    • Feb 2009
    • 10

    Reg:Cookies

    How to clear browser cookies in code behind ?
  • jg007
    Contributor
    • Mar 2008
    • 283

    #2
    This should give you a start -, at present it just adds the cookies to a listbox but would be easy to amend to delete them

    Code:
            private void GetCookies()
            {
              string path = Environment.GetFolderPath(Environment.SpecialFolder.Cookies);
              DirectoryInfo CookiesDirectory = new DirectoryInfo(path);
    
                foreach (FileInfo filex in CookiesDirectory.GetFiles())
                    if (filex.Name != "index.dat")
                    {
                        {
                            listBox1.Items.Add(filex.Name);
                        }
                    }
            }

    Comment

    • vinoth82
      New Member
      • Feb 2009
      • 10

      #3
      thank you very much , it is very helpful for me

      Comment

      Working...