HttpWebRequest does not detect new Vversion of remote file

  • Thread starter Thread starter Thomas Weise
  • Start date Start date
T

Thomas Weise

My app looks frequently onto a WEB page to check if a newer version is
available.
My code looks like this:

Private Sub ReadHtmlFile()
Dim hwRequest As HttpWebRequest
Dim hwResponse As HttpWebResponse
Dim srUpdate As IO.StreamReader

hwRequest =
CType(WebRequest.Create("http://www.mydomain.com/version.html"),
HttpWebRequest)
hwRequest.AllowAutoRedirect = False
hwResponse = CType(hwRequest.GetResponse, HttpWebResponse)

srUpdate = New IO.StreamReader(hwResponse.GetResponseStream,
Encoding.ASCII
...
End Sub

When the app is launched, it ready the most recent version of "version.html"
from the remote WEB server.
However, when I update "version.html" while the app is running, it does not
obtain the most recent version, but HttpWebResponse returns the outdated
file it read at the first time. Obviously the file is buffered somehow.

Does anybody have a clue how I can get around this?
Best regards, Thomas
 
HttpWebResponse works ok, it was just me who screwed the results up later in
my app.
Instead of renewing the internal representation of the HTML page, I always
added the newly downloaded text to the one already present.
 
Back
Top