I am trying to measure how much data is sent and received by a HttpWebRequest (and Response).
As far as I can tell, it is only possible to know the length of the request and response content, in other words the body, not the header.
Does anyone know how to get the full length? Either header and body to be summed or possibly just a means of measuring all network IO from the thread or process?
sum up header & body may yield the answer you're looking for. measuring nio is not a recommended approach since it needs elevated privilege for your app & assembly; whenever possible an app & its assemblies should only use lowest security-level possible to perform the app's intent and no more. in elevated privilege scenario necessarily assumes you have god-access to the machine (root / domain admin / etc.).
ref 1: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.contentlength.aspx
ref 2: http://msdn.microsoft.com/en-us/library/system.net.webheadercollection.aspx