By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 712 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Reg:Cookies

vinoth82
P: 10
How to clear browser cookies in code behind ?
Feb 12 '09 #1
Share this Question
Share on Google+
2 Replies


100+
P: 283
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

Expand|Select|Wrap|Line Numbers
  1.  
  2.         private void GetCookies()
  3.         {
  4.           string path = Environment.GetFolderPath(Environment.SpecialFolder.Cookies);
  5.           DirectoryInfo CookiesDirectory = new DirectoryInfo(path);
  6.  
  7.             foreach (FileInfo filex in CookiesDirectory.GetFiles())
  8.                 if (filex.Name != "index.dat")
  9.                 {
  10.                     {
  11.                         listBox1.Items.Add(filex.Name);
  12.                     }
  13.                 }
  14.         }
  15.  
  16.  
Feb 13 '09 #2

vinoth82
P: 10
thank you very much , it is very helpful for me
Feb 16 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.