c# nse File.Delete cannot delete "Temporary Internet Files" files,help me

Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Sep 2007
Posts: 4
Reputation: claverchou is an unknown quantity at this point 
Solved Threads: 0
claverchou claverchou is offline Offline
Newbie Poster

c# nse File.Delete cannot delete "Temporary Internet Files" files,help me

 
-1
  #1
Sep 8th, 2007
CODEGet "Temporary Internet Files" directory and files)
const int cookies = 32;
Shell32.Folder objFolder;
Shell32.FolderItems objFolderItems;
Shell32.ShellClass objShell;

string strFolderpath = System.IO.Path.GetTempPath().Substring(0, System.IO.Path.GetTempPath().Length - 1) + "orary Internet Files\\";
objShell = new Shell32.ShellClass();
objFolder = objShell.NameSpace(cookies);
objFolderItems = objFolder.Items();


foreach (Shell32.FolderItem objFolderItem in objFolderItems)
{

//MessageBox.Show(strFolderpath+objFolderItem.Path.ToString());

string strDeleteFile = strFolderpath + objFolderItem.Path.ToString();

File.Delete(strDeleteFile);//delete cannot

}
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 4
Reputation: claverchou is an unknown quantity at this point 
Solved Threads: 0
claverchou claverchou is offline Offline
Newbie Poster

RE:c# use File.Delete cannot delete "Temporary Internet Files" files,help me

 
-1
  #2
Sep 9th, 2007
CODEGet "Temporary Internet Files" directory and files)
const int cookies = 32;
Shell32.Folder objFolder;
Shell32.FolderItems objFolderItems;
Shell32.ShellClass objShell;

string strFolderpath = System.IO.Path.GetTempPath().Substring(0, System.IO.Path.GetTempPath().Length - 1) + "orary Internet Files\\";
objShell = new Shell32.ShellClass();
objFolder = objShell.NameSpace(cookies);
objFolderItems = objFolder.Items();


foreach (Shell32.FolderItem objFolderItem in objFolderItems)
{

//MessageBox.Show(strFolderpath+objFolderItem.Path.ToString());

string strDeleteFile = strFolderpath + objFolderItem.Path.ToString();

File.Delete(strDeleteFile);//delete cannot

}[/QUOTE]
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 4
Reputation: claverchou is an unknown quantity at this point 
Solved Threads: 0
claverchou claverchou is offline Offline
Newbie Poster

Re: c# use File.Delete cannot delete "Temporary Internet Files" files,help me

 
-1
  #3
Sep 9th, 2007
up
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 4
Reputation: claverchou is an unknown quantity at this point 
Solved Threads: 0
claverchou claverchou is offline Offline
Newbie Poster

Re: c# nse File.Delete cannot delete "Temporary Internet Files" files,help me

 
-1
  #4
Sep 9th, 2007
help me,thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 3
Reputation: jchandramouli is an unknown quantity at this point 
Solved Threads: 0
jchandramouli jchandramouli is offline Offline
Newbie Poster
 
1
  #5
34 Days Ago
private static void ClearCache(string fileName,string fileType)
{

// fileName = * to delete all files with sp.ext
// fileType = * to delete with all ext

String[] files = System.IO.Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache),
fileName + "."+ fileType + ", System.IO.SearchOption.AllDirectories);

foreach (String filePath in files)
{
try
{
System.IO.FileInfo f = new System.IO.FileInfo(filePath);
f.Delete();
}
catch (System.Security.SecurityException se)
{
continue;
}
catch (UnauthorizedAccessException uae)
{
continue;
}
catch (System.IO.IOException ie)
{
continue;
}
}
}
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC