Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 6 Aug 2008 17:54:15 +0500,    group: microsoft.public.dotnet.framework        back       


File Data and Time   
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

The above link is dummy (don't try it).

Using the class WebClient i can get the size of the file at download time , 
is there some way to get the date and time as i need to check the date and 
time (for comparison) before downloading..

TIA
Barry
date: Wed, 6 Aug 2008 17:54:15 +0500   author:   Barry

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

Re: File Data and Time   
Barry wrote:
> 
> My Client want the app to downalod files if they are newer then 24 hrs 
> (these files are updated every 24 hrs).

I don't know if you're still working on this, but if you are, I just
had a moment to look at WebClient.

I'd suggest setting the WebClient object's CachePolicy property to a
new RequestCachePolicy object which has its Level set to
RequestCacheLevel.Revalidate. That should check to see if the object
is in the local cache. If it is, it should ask the server if a newer
version of the object is available, and either return the cached
object (if there is no newer version) or download the newer one.

Then you can compare the returned object with the one you already have
to determine whether it's different.

-- 
Michael Wojcik
Micro Focus
Rhetoric & Writing, Michigan State University
date: Mon, 18 Aug 2008 13:59:29 -0400   author:   Michael Wojcik

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us