R
Roy Chastain
I need to download a file from a web server only if it has been modified since the last time it was downloaded. I am looking at
using WebClient.DownloadFile. I see that I can set http headers using the Headers Property. I see that there is a header of
If-Modified-Since that can be set using the WebHeaderCollection.Add method. What I don't know is
1) - How does this really work.
By that I mean if I set the value in the header and then call the method, will it only download the file if it has been modified,
or do I have to do some other sort of request and look at the modified time in the returned header and make my own decision about
calling the DownloadFile method or not.
2) - What is the correct format to use to set the header? There is an Add(string) and an Add(string,string). Would it be done
with Add("If-Modified-Since:date_time_string"), If so, what is the format of the date and time string?
Thanks
using WebClient.DownloadFile. I see that I can set http headers using the Headers Property. I see that there is a header of
If-Modified-Since that can be set using the WebHeaderCollection.Add method. What I don't know is
1) - How does this really work.
By that I mean if I set the value in the header and then call the method, will it only download the file if it has been modified,
or do I have to do some other sort of request and look at the modified time in the returned header and make my own decision about
calling the DownloadFile method or not.
2) - What is the correct format to use to set the header? There is an Add(string) and an Add(string,string). Would it be done
with Add("If-Modified-Since:date_time_string"), If so, what is the format of the date and time string?
Thanks