473,808 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpWebRequest does not detect new Vversion of remote file

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(WebReques t.Create("http://www.mydomain.co m/version.html"),
HttpWebRequest)
hwRequest.Allow AutoRedirect = False
hwResponse = CType(hwRequest .GetResponse, HttpWebResponse )

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

When the app is launched, it ready the most recent version of "version.ht ml"
from the remote WEB server.
However, when I update "version.ht ml" 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
Jan 15 '08 #1
1 1477
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.

"Thomas Weise" <th****@data-download.deschr ieb im Newsbeitrag
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
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(WebReques t.Create("http://www.mydomain.co m/version.html"),
HttpWebRequest)
hwRequest.Allow AutoRedirect = False
hwResponse = CType(hwRequest .GetResponse, HttpWebResponse )

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

When the app is launched, it ready the most recent version of
"version.ht ml" from the remote WEB server.
However, when I update "version.ht ml" 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


Jan 16 '08 #2

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

Similar topics

16
12650
by: thomas peter | last post by:
I am building a precache engine... one that request over 100 pages on an remote server to cache them remotely... can i use the HttpWebRequest and WebResponse classes for this? or must i use the MSHTML objects to really load the HTML and request all of the images on site? string lcUrl = http://www.cnn.com; // *** Establish the request
4
14528
by: R Reyes | last post by:
I am trying to code a file uploader (for forum/email attachments) from the client computer to a remote web server via the PUT method (since POST is not allowed ). However, the upload works ONLY when the file is inside a shared folder on my computer. If I try to upload from any other folder it does not work. Why is this? Reason being that whenever I upload files on other forums or websites I know I don't need to have my folder shared...
15
515
by: warlord | last post by:
I have a windows client app that is trying to download a file from a web server but I always get the following error when I call the GetResponse method of the Request object. The remote server returned an error: (404) Not Found. When I run it against a website on my local machine everything works perfectly, but not against the remote server. I'm sure it's a security or permissions problem of some sort, but I'm not sure where to start.
7
7692
by: Marc Bartsch | last post by:
Hi, I have a background worker in my C# app that makes a synchronous HttpWebRequest.GetResponse() call. The idea is to POST a file to a server on the internet. When I call HttpWebRequest.Abort() on the request object on another thread, GetResponse() returns with an exception as expected. However, when I monitor the network traffic, it does not seem to stop, but to continue to be active and to upload the file. The network is active even...
0
9721
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
9600
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
10631
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
10374
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...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
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...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
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();...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.