How can I programmatically tell if a binary file on a website (eg image) has changed without downloading it? Is there a way using HTTP methods (in C# in this case) to check prior to fully downloading it?
Really, you want to look for the Last-Modified header after issuing a HEAD
request (rather than a GET
). I wrote some code to get the HEAD
via WebClient
here .
You can check that whether the file is changed or not by requesting with HEAD .
Then, returned response header may include Last-Modified , or ETag if the web server support.
您可以执行HEAD请求并检查上次修改的日期时间值以及内容长度。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.