-1

C#.NET code to clear temporary internet files of internet explorer of any user.

Example: for user afvan0771 , there are temp internet files located at

C:\Users\afvan0771\AppData\Local\Microsoft\Windows\Temporary Internet Files

i want to clear all of them through c# code when button is clicked

habeeb afvan
  • 99
  • 1
  • 1
  • 4
  • So, what's the question here actually? (or) you mean ... you need someone to write the code for you? – Rahul Jun 04 '16 at 11:48
  • Please provide what you have tried and give more insight on how do you want to achieve your goal. Also more insight would help a lot. Right now I doubt anyone can help you since the case is not explained at all. – Kamil Solecki Jun 04 '16 at 11:51
  • tried deleting the files using the path mentioned below string path = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) but its not deleting any temp files – habeeb afvan Jun 04 '16 at 12:20
  • you should not do that... User can clear files himself if desired. – Phil1970 Jun 04 '16 at 14:32

2 Answers2

0

Here's example code:

            Directory.Delete(@"C:\examples\Directory", true);

Deletes the specified directory and, if indicated, any subdirectories and files in the directory.

Denis Kosov
  • 697
  • 6
  • 21
0

You could do this to get the path of temp internet files:

string path = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)

And then iterate over the directory and sub directories to delete filesa and folders

[edit] I just see that you want user specific environment variable. Maybe this question could help you: Related question

Community
  • 1
  • 1
Andrea Cattaneo
  • 568
  • 1
  • 6
  • 18