|
|
|
date: Wed, 6 Aug 2008 17:54:15 +0500,
group: microsoft.public.dotnet.framework
back
Re: File Data and Time
Barry wrote:
> Hello
>
> I need to know the date and time of a file on a internet site
>
> eg. http://www.triple-xxx.com/not-porn/somefile.zip
An HTTP server isn't required to provide that information, so you
can't reliably get it.
The closest thing is the value of the Last-Modified header, which the
standard (RFC 2616) says SHOULD be sent "whenever feasible". But that
leaves a lot of wiggle room. You're not guaranteed to get a
Last-Modified header in the server's response. And even if you do, of
course, there's no guarantee that it's correct.
Also, servers are allowed to cache response entities, so even with a
trustworthy server you should check for an Age header and assume the
resource could have been modified at any point in that time. (Age
indicates how long the entity has been in the cache; the server might
not check for updates until the cached copy reaches its expiration time.)
And the server's clock may not be synchronized with yours; the value
of the Date header (which the server must provide in most, though not
all, cases) can be used to estimate skew between the clocks, but it's
additional work.
> is there some way to get the date and time as i need to check the date and
> time (for comparison) before downloading.
HTTP/1.1 incorporates a fairly sophisticated caching mechanism. That's
what all HTTP clients should use to determine whether a resource has
been updated.
In this case, the If-Modified-Since request header looks like the best
approach. See RFC 2616 sec 14.28 (from rfc-editor.org and various
other sources).
Is that available through WebClient? I don't know. (I might get a
chance tomorrow to look it up.) If not, you need a better client
interface.
--
Michael Wojcik
Micro Focus
date: Thu, 07 Aug 2008 23:15:22 -0600
author: Michael Wojcik
Re: File Data and Time
Hi Muchael
Thanks for the detailed reply.
WebClient class does give some size in the Progress event i found it
incorrect.
My Client want the app to downalod files if they are newer then 24 hrs
(these files are updated every 24 hrs).
Barry
"Michael Wojcik" wrote in message
news:g7hm5i01l3a@news4.newsguy.com...
> Barry wrote:
>> Hello
>>
>> I need to know the date and time of a file on a internet site
>>
>> eg. http://www.triple-xxx.com/not-porn/somefile.zip
>
> An HTTP server isn't required to provide that information, so you can't
> reliably get it.
>
> The closest thing is the value of the Last-Modified header, which the
> standard (RFC 2616) says SHOULD be sent "whenever feasible". But that
> leaves a lot of wiggle room. You're not guaranteed to get a Last-Modified
> header in the server's response. And even if you do, of course, there's no
> guarantee that it's correct.
>
> Also, servers are allowed to cache response entities, so even with a
> trustworthy server you should check for an Age header and assume the
> resource could have been modified at any point in that time. (Age
> indicates how long the entity has been in the cache; the server might not
> check for updates until the cached copy reaches its expiration time.)
>
> And the server's clock may not be synchronized with yours; the value of
> the Date header (which the server must provide in most, though not all,
> cases) can be used to estimate skew between the clocks, but it's
> additional work.
>
>> is there some way to get the date and time as i need to check the date
>> and time (for comparison) before downloading.
>
> HTTP/1.1 incorporates a fairly sophisticated caching mechanism. That's
> what all HTTP clients should use to determine whether a resource has been
> updated.
>
> In this case, the If-Modified-Since request header looks like the best
> approach. See RFC 2616 sec 14.28 (from rfc-editor.org and various other
> sources).
>
> Is that available through WebClient? I don't know. (I might get a chance
> tomorrow to look it up.) If not, you need a better client interface.
>
> --
> Michael Wojcik
> Micro Focus
date: Sat, 9 Aug 2008 11:13:19 +0500
author: Barry
|
|