gwell said:
I am tryng to write a windows service that will retrieve csv files and
other files overHTTP. I only want to get those files that have been
updated recently. Considering the discussion above do you think this
is an unreliable way to go? Maybe I should try look at ftp?
Here's the thing. I think FTP could be a good way to go if you had to do
this in multiple locations, where reliability may be in question. The
problem is most hosts nowadays do properly return the Last-Modified
header -- at the very least, all installs of Apache and IIS CAN return
the Last-Modified header, and do by default.
The major con with using an FTP connection is that you're doing quite a
bit more work to do what you could do with a simpleHTTPrequest. The
overhead might be minimal, but in code, tracking FTP sites, logins,
etc., that's going to be far and away more work than simply tracking the
URL and checking its Last-Modified header.
Now, given your goal here of grabbing remote files via a service, I
think you should definitely stick toHTTPuntil such time as it becomes
an issue for you. Last-Modified is part of the RFC, so RFC-friendly
webservers will understand what you're looking for (which, just with the
two mentioned above accounts for something like 96%+ of all webservers
in use publicly on the Internet), and it's fairly trivial to implement.
I cant seem to get the last-modified property off the header... here
is some sample code I am testing:
Any help would be greatly appreciated... thanks!
[...]
Jon's response already covered the code stuff.
Chris.