title: Optimizing HttpWebResponse - GetResponse
body: <p>I'm using the following lines of code to read the response of an asynchronous HttpWebRequest. This seems to be the largest amount of time spent in a particular operation. Is there anything I can optimize here?</p>
  
  <pre><code>System.Net.HttpWebResponse oResp =(System.Net.HttpWebResponse)oReq.EndGetResponse(oResult);
  oResp = (HttpWebResponse)oReq.GetResponse();
  StreamReader oStreamReader = new StreamReader(oResp.GetResponseStream());
  string sResponse = oStreamReader.ReadToEnd();
  </code></pre>
  
  <p>...goes on to make an XmlDocument, append some more XML to it, then perform an XSL transform.</p>
  
  <p>Creating the Connections:</p>
  
  <pre><code>HttpWebRequest oReq;
  oReq = (HttpWebRequest)WebRequest.Create(sUrl + sQueryString);
  oReq.ContentType = sContentType;
  oReq.Method = "POST";
  oReq.ContentLength = aBytes.Length;
  Stream oStream = oReq.GetRequestStream();
  oStream.Write(aBytes, 0, aBytes.Length);
  oStream.Close();
  AsyncState oState = new AsyncState(oReq);
  return oReq.BeginGetResponse(fCallBack, oState);
  </code></pre>