Re: HttpWebRequest problem

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 03/11/04


Date: Thu, 11 Mar 2004 11:01:51 -0500

Abhishek,

    The HttpWebRequest object does not use the IE cache internally to return
results. It estabishes the connection to the server every time. Chances
are you are seeing the results of a cached document by the proxy, which is
giving you the results.

    If you add the following headers, your proxy should acknowlegdge one of
them, and not give you a cached document or cache it internally:

Pragma: no-cache
Cache-Control: no-cache
Expires: Sat, 20 Sep 2000 01:56:59 GMT (this is some date in the past).

    Hope this helps.

-- 
               - Nicholas Paldino [.NET/C# MVP]
               - mvp@spam.guard.caspershouse.com
"Abhishek Srivastava" <abhishek-srivastava@nospam.net> wrote in message
news:uc$fCiyBEHA.3568@tk2msftngp13.phx.gbl...
> Hello All,
>
> I have written a program to download a text file from a web server. The
> program uses HttpWebRequest Object.
>
> My program runs once at 10:00 AM every day. The problem is that the
> HttpWebRequest object internally uses the browser cache.
>
> So when today my program runs, it doesn't download a fresh copy. But
> picks the one which is already present in the browser's cache.
>
> So when I process the download file, most of my processing fails because
> that data is already present in my DB.
>
> If I open internet explorer, enter the same URL and hit refresh couple
> of times, the new version of the text file appears. Now if I run my
> application, the application also runs fine.
>
> So clearly HttpWebRequest object is using the cache of the browser.
>
> Is there any possible way to avoid this?
>
> This is a real PITA for me, because my scheduled job always fails and I
> have to run the application manually.
>
> I tried to open a raw TCP connection to the site but that failed too...
> because I live in a firewall protected network. So the only way to
> connect to a external site is via the proxy server.
>
> Please help me with this. I have been looking for a solution to this
> problem for a long time now.
>
> Can someone, who really knows the internals of HttpWebRequest confirm
> whether the internal implementation of this class uses the browser's
> cache and how to avoid this feature?
>
> regards,
> Abhishek.


Relevant Pages

  • Re: MS Windows 2003 SBS SP1 w/ ISA Server 2000 - Issues publishing a WSS site via ISA Server 200
    ... attempting to access the site from an external network (i.e. the Internet), ... On the SBS 2003 Server open the Server Management console. ... client computer, clear DNS, IIS and ISA cache on SBS and check if the ...
    (microsoft.public.windows.server.sbs)
  • Re: Access to "external" computer
    ... server up too much or made some kind of mistake. ... The provided PC (cache box) has no monitor, ... I found a flow chart on the internet of ISA security and followed it. ...
    (microsoft.public.backoffice.smallbiz2000)
  • RE: Exchange problem - user cannot login via OWA
    ... The Exchange SP1 hotfix could be found here. ... Expand Server,, Protocols, HTTP ... 301471 How to Delete the Web Cache on Internet Security and Acceleration ...
    (microsoft.public.windows.server.sbs)
  • Re: SBS server cant access internet
    ... ISA cache (If you has installed ISA on the server box) and then rerun CEICW ... Launch Internet Explorer. ... Please try to access web sites using firefox to ...
    (microsoft.public.windows.server.sbs)
  • HttpWebRequest problem
    ... I have written a program to download a text file from a web server. ... HttpWebRequest object internally uses the browser cache. ... If I open internet explorer, enter the same URL and hit refresh couple ...
    (microsoft.public.dotnet.languages.csharp)

Loading