Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to clean Internet Cookies and Cache using C# Windows application in VS 2005. .
Posted
Updated 29-Jul-11 8:42am
v2

1 solution

Cache
How To Clear Internet Cache Using C#
Cookie
An easy way would be to use Environment.SpecialFolder enumeration to get the Cookies folder and then Delete all the files inside the folder
C#
public void deleteCookies()
    {
        DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Cookies));
        foreach (FileInfo fl in di.GetFiles())
            fl.Delete();
    }

Credit goes to Clearing Internet Cookies In C#

Hope the above information helps.
 
Share this answer
 
v2
Comments
softprga 26-Dec-13 2:00am    
I'm getting error using this code.
'The path is not of a legal form.'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900