title: Get HTTPWebResponse details after sending request
body: <p>Using .Net Framework's System.Diagnostics library, i want to simulate something similar to what i'm getting using JMeter. Basically i want to be able to send an HTTPWebRequest and from the response, i want to get the following details as accurately as i can:</p>
  
  <ul>
  <li>The Response Time (in seconds)</li>
  <li>The Response Size (in KBs)</li>
  <li>The Response Rate (in KB/s) without embedded resources</li>
  </ul>
  
  <p>Currently i have the following code:</p>
  
  <pre><code>HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL);
          request.CookieContainer = new CookieContainer();
          request.Method = HTTPRequestType.GET.ToString();
          request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36";
  
          Stopwatch watch = new Stopwatch();
          watch.Start();
          WebResponse webResponse = request.GetResponse();
          watch.Stop();
  
          HttpWebResponse httpResponse = (HttpWebResponse)webResponse;
          Stream streamResponse = httpResponse.GetResponseStream();
  </code></pre>
  
  <p>With this code i can get the response time from the watch's ElapsedTime property. How do i go about getting the rest of the data i want, and am i missing any important properties i need to set in my request to make the simulation as accurate as possible (things like cookies, caching, user-agent...etc)? </p>