Solved

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

Posted on 2009-05-05
2
5,619 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 125 total points
Comment Utility
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
Comment Utility
Hi,

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now