473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to clean browser cache?

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

DirectoryInfo di = new
DirectoryInfo(Environment.GetFolderPath(Environmen t.SpecialFolder.InternetCache));

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.
Aug 13 '07 #1
1 3291
Kfir,

You should use the functions in the WinInet library to do this. You can
call the FindFirstUrlCacheEntry and FindNextUrlCacheEntry functions to
enumerate through the cache, and then call the DeleteUrlCacheEntry or
DeleteUrlCacheGroup 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]
- mv*@spam.guard.caspershouse.com

"Kfir Marouani" <fe*******@hotmail.comwrote in message
news:O2**************@TK2MSFTNGP06.phx.gbl...
Hi,
I'm trying to delete files from the browser's cache by doing this:

DirectoryInfo di = new
DirectoryInfo(Environment.GetFolderPath(Environmen t.SpecialFolder.InternetCache));

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.


Aug 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Tony Marston | last post by:
If the use of the browser's BACK button is interfering with the operation of your web application then take a look at this article entitle "Back Button Blues" ...
2
by: Ben | last post by:
Hi all, I have written a web server that listens for requests: class MyHandler(BaseHTTPRequestHandler): def do_GET(self): if (self.path)=='/': data=makeList() else:
1
by: onewebclick | last post by:
Is there a way to detect a browser cache is full using javascript or HTML thorugh a web page and inform the user to clear the cache to improve performance of the website. It looks like google's...
3
by: Sergey Surkov | last post by:
Hello Does anybody know how to make FireFox to cache data that comes via XMLHttpRequest? Here is the issue I deal with: - On the web server (apache2) I have a static xml file test.xml - When I...
1
by: Satish Appasani | last post by:
am developing a web application using Forms Authentication. User is logged out using FormsAuthentication.SignOut(). After logging out, ifthe user clicks Back button in the browser, the user is...
21
by: nsimeonov | last post by:
Hello, Does anyone have any idea how Gmail does this? I have a web application and people complain sometimes about some problems and most of the time it turns out it's the browser's cache...
11
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses master pages. I have some pages that must not be cached on the client. In ASP.NET 1.1 I achieved this using metatags: <meta...
6
by: ernesto.tejeda | last post by:
Hello, I have a couple of questions regarding the loading of .js files for the browser and would like anyone to point me wher to find the answer (or if you know the answer and tell me will do just...
10
by: Simon | last post by:
As title. How to clean out VSWebCache? Any good way to do that? Thanks.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.