From: Tony Toews [MVP] on
Rather than downloading the entire file just to see if it's changed
I'd just like to get the date/time and/or size of a file on an HTTP
site.

I've searched somewhat using AsyncRead but nothing quite relevant
there that I can see. I probably don't know what keywords to use.

I'm using Karl Peterson's NetGrab control to download the file.
http://vb.mvps.org/samples/NetGrab/

Karl

Hint, hint, if this is possible you feel like adding this to your user
control? <smile>

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a free, convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
From: mayayana on
You want to send HEAD instead of GET. They're
the same thing except that HEAD returns only the
header while GET returns the header and content.

The following link is for a userControl that uses
winsock directly. You might find an easier method.
If not, this method should work because it carries
out the server conversation directly. You're sending
the HEAD/GET yourself and receiving the server
response yourself -- no middle name. (Most of the
Windows API methods are going through IE. The
AsyncRead method is interesting but it doesn't seem
to allow any control. And given that it has an option
to read from cache it appears to be just another wrapper
around IE functionality. (The cache would presumably
be the IE cache.)

With the userControl you'd just need to do
a bit of editing. As it currently is I only have it set
up for doing a GET.

www.jsware.net/jsware/vbcode.php5#htp


> Rather than downloading the entire file just to see if it's changed
> I'd just like to get the date/time and/or size of a file on an HTTP
> site.
>
> I've searched somewhat using AsyncRead but nothing quite relevant
> there that I can see. I probably don't know what keywords to use.
>
> I'm using Karl Peterson's NetGrab control to download the file.
> http://vb.mvps.org/samples/NetGrab/
>
> Karl
>
> Hint, hint, if this is possible you feel like adding this to your user
> control? <smile>
>
> Tony
> --
> Tony Toews, Microsoft Access MVP
> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
> For a free, convenient utility to keep your users FEs and other files
> updated see http://www.autofeupdater.com/
> Granite Fleet Manager http://www.granitefleet.com/


From: Nobody on
Besides what mayayana suggested, check this sample:

SAMPLE: Vbhttp.exe Demonstrates How to Use HTTP WinInet APIs in Visual Basic
http://support.microsoft.com/kb/259100/en-us

I just tried it. It doesn't have "HEAD" option in the GUI, so in
btSend_Click(). I changed "GET" to "HEAD", specified the URL to a ZIP
file(without http://) and it worked fine, without downloading the whole
file. Server logs shows that only 273 bytes were transferred as opposed to
2MB.

If you search the source for "GET" whole word only, you will only find one
line of code to change, but you need "GET" when you download the whole file.
In production, you need to check the status code which should be 200, before
using Content-Length.



From: C. Kevin Provance on
Wow...that is an *old school* example!

--
2025
If you do not believe in time travel,
your beliefs are about to be tempered.

http://www.facebook.com/group.php?gid=43606237254
"Nobody" <nobody(a)nobody.com> wrote in message
news:%23OFttLNYKHA.3612(a)TK2MSFTNGP02.phx.gbl...
| Besides what mayayana suggested, check this sample:
|
| SAMPLE: Vbhttp.exe Demonstrates How to Use HTTP WinInet APIs in Visual
Basic
| http://support.microsoft.com/kb/259100/en-us
|
| I just tried it. It doesn't have "HEAD" option in the GUI, so in
| btSend_Click(). I changed "GET" to "HEAD", specified the URL to a ZIP
| file(without http://) and it worked fine, without downloading the whole
| file. Server logs shows that only 273 bytes were transferred as opposed to
| 2MB.
|
| If you search the source for "GET" whole word only, you will only find one
| line of code to change, but you need "GET" when you download the whole
file.
| In production, you need to check the status code which should be 200,
before
| using Content-Length.
|
|
|


From: Tony Toews [MVP] on
"mayayana" <mayaXXyana(a)rcXXn.com> wrote:

> You want to send HEAD instead of GET. They're
>the same thing except that HEAD returns only the
>header while GET returns the header and content.

Excellent. Thanks.

> The following link is for a userControl that uses
>winsock directly. You might find an easier method.
>If not, this method should work because it carries
>out the server conversation directly. You're sending
>the HEAD/GET yourself and receiving the server
>response yourself -- no middle name. (Most of the
>Windows API methods are going through IE. The
>AsyncRead method is interesting but it doesn't seem
>to allow any control. And given that it has an option
>to read from cache it appears to be just another wrapper
>around IE functionality. (The cache would presumably
>be the IE cache.)

Ah, now that's interesting. I wonder what happens if IE doesn't exist
on the system. Aren't the EU versions of Windows setup so that IE is
optional? Or something like that.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a free, convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
 |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11
Prev: Printing the Form
Next: Common Controls 5.0 / Windows 7