I need to detect the total size of a web page, including embedded images- the
page size that's shown by IE when you rick-click a page and select
'Properties'. Using the WebClient class, I'm trying to request an entire page
so that I can determine its size. However, every method I've tried returns
ONLY the page HTML and not embedded objects, so I'm not able to determine the
page size by downloading the primary URL.
I can iterate through the objects in the downloaded stream to find the image
URL. It's a dynamically generated image that's marked with type 'unknown.'
I'm able to request the image URL in a second trip to the server, but once
again, I'm unable to view its size or any other image related properties
(because its of type 'unknown'). The image URL looks like this:
<input type="image" name="map1:imgButton" id="map1_imgButton" title="The
Map" src="/ImageRenderer.aspx?mCtxStr=37672534B564000000000&mapId=map1"
alt=""
style="border-color:Transparent;border-width:0px;border-style:None;height:300px;width:400px;" />
When the ImageRenderer.aspx is not working, a broken image is displayed on
the page. But I can't find any way to detect this condition (if I could
check the image or total page size, I'd know when no image has been
generated).
Any idea on how I can determine the size of the entire page, including
images, or determine when this image is broken?
Joerg Jooss - 01 Apr 2005 21:07 GMT
> I need to detect the total size of a web page, including embedded
> images- the page size that's shown by IE when you rick-click a page
[quoted text clipped - 3 lines]
> objects, so I'm not able to determine the page size by downloading
> the primary URL.
Because that's how HTTP works. You request a resource, you get a
resource. HTTP (and WebClient) are completely ignorant of the fact that
a HTML page may consist of many resources.
> I can iterate through the objects in the downloaded stream to find
> the image URL. It's a dynamically generated image that's marked with
[quoted text clipped - 15 lines]
> Any idea on how I can determine the size of the entire page,
> including images, or determine when this image is broken?
You must fetch all resources. In case you're doing some local caching,
you can throw in some conditional GET requests or HEAD requests to
minimize network traffic, but that's it.
Regarding detecting broken images, I would expect the remote site to
indicate failure using HTTP error codes (like 500).
Cheers,

Signature
http://www.joergjooss.de
mailto:news-reply@joergjooss.de