WebClient.DownloadData without cache

Y

YA

I am using WebClient to download a text file from the net every 2 minutes.
The problem is that I think I am reading the file from cache since when the
file is change I still get the old file.
Here is my code:
Dim myWebClient As New WebClient()
Dim responseArray As Byte() = myWebClient.DownloadData(szURL)

How can I tell WebClient not to use cache ?

Thanks in advance
(e-mail address removed)
 
C

Chris Langsenkamp

Two things to try:

1) Server cache control:
..asp page instead of .txt file in your url, .asp includes anti-caching headers ahead of the text file content read from the text
file. see FileSystemObject in ASP to read the file content.

2) make browser think it's a new url:
append "?r=" & rnd * 999999 to the url of the txt file. The web server won't care about the trailing stuff but the browser thinks
it's gonna get a new result and will fetch it. This syntax may not be perfect but you get the idea that a constantly changing
QueryString portion of the URL will make browser keep pulling from the server.

Chris Langsenkamp
http://chat.cleverchat.net/

----- Original Message -----
I am using WebClient to download a text file from the net every 2 minutes.
The problem is that I think I am reading the file from cache since when the
file is change I still get the old file.
Here is my code:
Dim myWebClient As New WebClient()
Dim responseArray As Byte() = myWebClient.DownloadData(szURL)

How can I tell WebClient not to use cache ?

Thanks in advance
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top