Delete HttpCookies on XP-Desktop machine using C# console program

Hi,

I am writing a small test program, which should delete all cookies created by a website on my local machine.

This program is a C# Console based program.

Could any one please let me know how to proceed.

Thanks,
Sarang-Sarang


Answer this question

Delete HttpCookies on XP-Desktop machine using C# console program

  • Javafun

    Try the following:

    string path = Environment.GetEnvironmentVariable("HOMEDRIVE");
    path += Environment.GetEnvironmentVariable("HOMEPATH");
    path += "\\Cookies";

    DirectoryInfo dI = new DirectoryInfo(path);
    FileInfo[] cookies =dI.GetFiles();
    foreach (FileInfo cookie in cookies)
    {
       if (cookie.Name != "index.dat")
      {
         cookie.Delete();
      }
    }

    Regards,

    Andres.


  • Delete HttpCookies on XP-Desktop machine using C# console program