HttpWebRequest.Create how to stop caching?

dchurch

New member
Joined
Feb 8, 2008
Messages
1
Programming Experience
10+
Hi all,

I'm pretty much at my wits end with this one! ;-)

I have a Windows Forms program that connects to a web server and strips out the useful information that it needs and puts it into a database.

The problem is the page updates about 10-15 times a day, and the HTTPWebRequest in my program caches the pages and doesn't check to see if there is a later version. I've even tried adding a &rnd=[random number here] to the end of the address to try and force a reload.

Any ideas would be very appreciated. I'm using VB.Net 2003 FYI.


VB.NET:
        Dim strURL As String
        Dim strResult As String
        Dim wbrq As HttpWebRequest
        Dim wbrs As HttpWebResponse
        Dim sr As StreamReader

        ' Set the URL (and add any querystring values)  
        strURL = "http://xxxxxxxxx/xxxx.php"

        ' Create the web request  
        wbrq = HttpWebRequest.Create(strURL)   
        wbrq.Method = "GET"

        ' Read the returned data   
        wbrs = wbrq.GetResponse
        sr = New StreamReader(wbrs.GetResponseStream)
        strResult = sr.ReadToEnd.Trim
        sr.Close()

        WriteData(strResult) ' UDF which strips out the HTML etc... that I don't need.
 
Back
Top