How to calculate total size of a page with additional files and scripts
<p>I would like to ask if it's possible to get programmatically in C#, a specific site content size. By size I mean: the full size of the site including all images and scripts referenced in the head section or body and so on. For example if we have a site <a href="http://www.google.com" rel="nofollow">http://www.google.com</a> I want o get it's total size including the logo, scripts refered to, and so on as it will be presented to the user not just the main page.</p>

<p>Here is a picture what I mean: (click for full size)</p>

<p><a href="http://i.stack.imgur.com/5LPe9.png" rel="nofollow"><img src="http://i.stack.imgur.com/5LPe9.png" alt=""></a></p>

<p>If we use IE Developer tool in IE 9, and start capturing traffic on the network session, than we hit google.com and it shows the total files loaded (.js, .png, and so on) and the time of loading in milliseconds.</p>

<p>I tried to do something similar using a webrequest but i get only 43kb instead of 101 as IE developer tool gets.</p>

<p>Here is the code:</p>

<pre><code>WebRequest request = WebRequest.Create(textBox2.Text.ToString());     
request.Credentials = CredentialCache.DefaultCredentials;           
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();      
StreamReader reader = new StreamReader(dataStream);          
string responseFromServer = reader.ReadToEnd();         
byte[] bytes = Encoding.ASCII.GetBytes(responseFromServer);
MessageBox.Show(ConvertSize(responseFromServer.Length) + "  -  " + responseFromServer.Length.ToString());
reader.Close();
dataStream.Close();
response.Close();
</code></pre>

<p>How can I get the total size of a site including all images, js and additional files used/referenced in that specific page? Thanks a lot!</p>
