C#.net – 인터넷 쿠키, 히스토리, 캐시 지우기

c#에서 인터넷 쿠키, 히스토리, 캐시를 지워야 할 경우 사용한다.

string[] strFiles1 = Directory.GetFiles(Environment.GetFolderPath(
Environment.SpecialFolder.History), "*", SearchOption.AllDirectories);
string[] strFiles2 = Directory.GetFiles(Environment.GetFolderPath(
Environment.SpecialFolder.Cookies), "*.txt", SearchOption.AllDirectories);
string[] strFiles3 = Directory.GetFiles(Environment.GetFolderPath(
Environment.SpecialFolder.InternetCache), "*", SearchOption.AllDirectories);


FileInfo fileDel = null;


foreach (string tmp in strFiles1)
{
    fileDel = new FileInfo(tmp);
    if (fileDel.Exists)
    {
        fileDel.Delete();
    }
}