[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to clear all cookies/cache for IE browser using C# code/.NET

Posted on 2009-05-05
2
Medium Priority
?
6,353 Views
Last Modified: 2012-05-06
Hi,

I want to clear all the cookies/cache from the IE browser using Visual C# code.

Can any1 plz provide me code for it?

- Dev
0
Comment
Question by:dev_qasource
2 Comments
 
LVL 5

Accepted Solution

by:
ashokpumca earned 250 total points
ID: 24302743
Check this code, hope this will help..

using System.IO;
void clearIECache()
{
   ClearFolder (new DirectoryInfo (Environment.GetFolderPath
      (Environment.SpecialFolder.InternetCache)));
}
 
void ClearFolder (DirectoryInfo folder)
{
   foreach (FileInfo file in folder.GetFiles())
      { file.Delete(); }
   foreach (DirectoryInfo subfolder in folder.GetDirectories())
      { ClearFolder(subfolder); }
}
 
public static void Main( )
{
   new Test().clearIECache ();
}
0
 

Author Closing Comment

by:dev_qasource
ID: 31577937
Hi,

Thanks for the solution. Do you have similar code to maximize the web browser using C#?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question