How to clean browser cache?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kfir Marouani

    #1

    How to clean browser cache?

    Hi,
    I'm trying to delete files from the browser's cache by doing this:

    DirectoryInfo di = new
    DirectoryInfo(E nvironment.GetF olderPath(Envir onment.SpecialF older.InternetC ache));

    foreach (FileInfo fi in di.GetFiles())

    {

    fi.Delete();

    }

    The strange thing is that it only delete 2 files! It's doesn't "see" the
    rest of the files.

    Any idea?

    Thanks in advance.


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: How to clean browser cache?

    Kfir,

    You should use the functions in the WinInet library to do this. You can
    call the FindFirstUrlCac heEntry and FindNextUrlCach eEntry functions to
    enumerate through the cache, and then call the DeleteUrlCacheE ntry or
    DeleteUrlCacheG roup functions to delete the entries in the cache.

    If you need help with the definitions for the functions, then you can
    probably get them from http://www.pinvoke.net.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Kfir Marouani" <feint_six@hotm ail.comwrote in message
    news:O2VVtCa3HH A.4400@TK2MSFTN GP06.phx.gbl...
    Hi,
    I'm trying to delete files from the browser's cache by doing this:
    >
    DirectoryInfo di = new
    DirectoryInfo(E nvironment.GetF olderPath(Envir onment.SpecialF older.InternetC ache));
    >
    foreach (FileInfo fi in di.GetFiles())
    >
    {
    >
    fi.Delete();
    >
    }
    >
    The strange thing is that it only delete 2 files! It's doesn't "see" the
    rest of the files.
    >
    Any idea?
    >
    Thanks in advance.
    >
    >

    Comment

    Working...