By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,424 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,424 IT Pros & Developers. It's quick & easy.

Dispable http Caching at proxy and local level

P: n/a
Hello All,

How do I completly and totally disable any kind of caching when making a
HttpWebRequest. I have an application which downloads a file from the
web. This file is updated on a daily basis.

However, my application keeps downloading the same file again and again.
When I open the same URL from my browser and hit the refresh button, I
see the new version of the file.

Here is the code which I have written.

HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://www.myserver.com/downloadfile.asp");
WebProxy proxy = new WebProxy();
proxy.Address = new Uri("http://myproxy:8088");
request.Proxy = proxy;
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
if (response != null)
{
Stream responseStream = response.GetResponseStream();
Encoding encoding = Encoding.GetEncoding("UTF-8");
if (reader != null)
{
char[] buffer = new char[BUFFER_SIZE];
int count = reader.Read(buffer, 0, BUFFER_SIZE);
while(count > 0)
{
......
}
}
}
I saw all the properties of the HttpWebRequest and WebProxy classes but
could find anything which disables caching for me.

Thanks for your help in advace.

regards,
Abhishek.
Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.