[REPOST] Dispable Http Caching
From: Abhishek Srivastava (abhishek-srivastava_at_nospam.net)
Date: 02/10/04
- Next message: Nick: "HttpModule Question (getting really weird results)"
- Previous message: Dan K.: "Using one Method to reset ErrorProvider in all Controls ?"
- Next in thread: Joerg Jooss: "Re: [REPOST] Dispable Http Caching"
- Reply: Joerg Jooss: "Re: [REPOST] Dispable Http Caching"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Feb 2004 18:58:09 +0530
Hello All,
Apologies to everyone, I posted this before but received no response. I
feel someone must have come accross this problem before, and I need a
solution desparately.
I have written a C# program which downloads a file from a webserver on a
daily basis. (http://www.myserver.com/myfile.asp)
The problem is that either the proxy/browser's cache is being used
because my C# program runs successfully but downloads the file from
previous run.
Now, if I open my browser and visit that URL, click refresh plenty of
times, I see the latest file. Now if I run my C# program to download
file, the program also downloads the latest file.
So the either the Browsers or the proxy's cache is being used.
I want to always download the latest file. So my C# program should not
use the cache at all.
How do I make sure that no cache is used (either the browser or proxy).
Here is the code snipped from my program.
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.
- Next message: Nick: "HttpModule Question (getting really weird results)"
- Previous message: Dan K.: "Using one Method to reset ErrorProvider in all Controls ?"
- Next in thread: Joerg Jooss: "Re: [REPOST] Dispable Http Caching"
- Reply: Joerg Jooss: "Re: [REPOST] Dispable Http Caching"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|