I am using HttpWebRequest and HttpWebResponse in VB.NET to check the timestamp of a specific file which i know is updated periodically(every 4-10 minutes or so). The thing is, it seems like this is caching results because there is a lag between when the file is updated and when my program sees that the file has been updated. But the IsFromCache value of the response object returns false.
If I navigate to the directory listing and check the timestamp myself, I can see that the file has been updated, but if I then run my program, it will still return the old timestamp.
This is the code that gets the timestamp.
Any thoughts on this?
If I navigate to the directory listing and check the timestamp myself, I can see that the file has been updated, but if I then run my program, it will still return the old timestamp.
This is the code that gets the timestamp.
Code:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] request [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] HttpWebRequest
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] response [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] HttpWebResponse
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] client [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] WebClient()
client.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials
request = [/SIZE][SIZE=2][COLOR=#0000ff]CType[/COLOR][/SIZE][SIZE=2](WebRequest.Create(([/SIZE][SIZE=2][COLOR=#a31515]"http://"[/COLOR][/SIZE][SIZE=2] & fileName)), HttpWebRequest)
response = [/SIZE][SIZE=2][COLOR=#0000ff]CType[/COLOR][/SIZE][SIZE=2](request.GetResponse(), HttpWebResponse)
serverTime = response.LastModified
response.Close()
[/SIZE]