473,938 Members | 17,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebClient.Downl oadData without cache

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.Dow nloadData(szURL )

How can I tell WebClient not to use cache ?

Thanks in advance
ra***@hotmail.c om

Nov 17 '05 #1
1 1345
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 FileSystemObjec t 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 -----
"YA" <ra***@hotmail. com> wrote in message news:%2******** *******@tk2msft ngp13.phx.gbl.. .
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.Dow nloadData(szURL )

How can I tell WebClient not to use cache ?

Thanks in advance
ra***@hotmail.c om


Nov 17 '05 #2

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

Similar topics

2
4690
by: Gary Short | last post by:
Hello group, I was wondering if anyone here could help me with an odd WebClient problem. When I run the following code: WebClient aWebClient = new WebClient(); Byte aBA = aWebClient.DownloadData("http://www.microsoft.com"); string strContent = Encoding.ASCII.GetString(aBA); Everything works as expected. However, when I run the following code:
1
3267
by: yyy | last post by:
This problem bothers me for a long time: I use WebClient.DownloadData in order to read text from an HTML document this way: WebClient c = new WebClient(); string html= ASCIIEncoding.Default.GetString(c.DownloadData("http://www.test.com")); When I run the code, I get this error message after a few seconds:
1
2813
by: ATS | last post by:
ERR - WebClient.DownloadData returns "protocol violation" Please help, I'm getting a "protocol violation" from a site that is working perfectly fine when I issue WebClient.DownloadData as such: WebClient WebClient_Temp = new WebClient(); byte zbyteTemp = WebClient_Temp.DownloadData (
2
4907
by: Rags | last post by:
Hi We are creating a web application using .NET which renders some reports. The reports are created in MS Reporting Services and can be accessed by typing in a URL with the required parameters in a browser. The reports are getting rendered fine if I type the URL in the browser. Within the web application, however, we are using the webclient.downloaddata method to extract the HTML by specifying the URL and rendering within the .NET...
8
9057
by: DEWright_CA | last post by:
Why does WebClient.DownloadFile loose my completed path? Ok, I have a function in my app then when my button is clicked it checks to see if the files come from a local drive or a http address. The portion of the code that pulls from the drive works great, but when the http address is active it changes the originating path to my C:\Windows\System32 folder instead of the proper path. I keep the path as a field on my form so I am certain...
1
5610
by: YA | last post by:
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
4
3696
by: Crirus | last post by:
Hi there! Fisrt the question: there is a ay to make the DownloadData when I want? I have a WebClient class I use myWebClient.DownloadData(remoteUrl) to connect to internet server All this in a separate thread for asincron pourpose Anyway, when I try to close the application before DownloadData returned, it wont stop this thread.
6
4386
by: Dave Starman | last post by:
Hello, I am trying to download web data into my current application. Failing many attempts I tried to run the sample from the MS Help files with no luck. If I create a new solution and put the sample code on a button then it works. However, when do the same on a new form in my existing solution then I get following error. Could there be some global settings in my application that are causing problems? Thanks in advance,
1
1789
by: jmk | last post by:
I'm trying to use an external SMS-service through .NET Framework 1.1 and using the webClient.DownloadData(strMessage) method. The strMessage is a string consisting the parameters to send a message, and the return-value to the DownloadData method is to be a status code for the requested message. However, using this method causes a connection-timeout from the SMS-service. Sending the same strMessage using reponse.redirect(strMessage) sends...
0
10134
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9963
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11524
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10657
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9857
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7384
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.