Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / April 2005

Tip: Looking for answers? Try searching our database.

System.NET.WebClient and total page size

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon - 01 Apr 2005 03:35 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 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.