title: Find out results of httpwebrequest POST
body: <p>Please refer to the below code.  How can I test/debug, whether the below code worked correctly or not. It runs and there are no compilation/runtime errors. </p>
  
  <p>The end result of the below code is to set one of the controls in the page, to hold the POST data from below code. However I haven't come that far yet.</p>
  
  <pre><code>   protected override void OnInit(EventArgs e)
  {
  
      ASCIIEncoding encoding = new ASCIIEncoding();
      string postData = "http://s.com/is/image/scom/2Peel";
      byte[] data = encoding.GetBytes(postData);
  
      // Prepare web request...
      HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://m.com/Confirm.aspx?ID=175");
      myRequest.Method = "POST";
      myRequest.ContentType = "application/x-www-form-urlencoded";
      myRequest.ContentLength = data.Length;
      Stream newStream = myRequest.GetRequestStream();
      // Send the data.
      newStream.Write(data, 0, data.Length);
      newStream.Close();
  
  }
  </code></pre>
  
  <p><strong>Update 1:</strong> I tried to find out the response using below code, but the page doesn't load at all. </p>
  
  <pre><code>HttpWebResponse response = (HttpWebResponse)myRequest.GetResponse();
  
  Console.WriteLine("Content length is {0}", response.ContentLength);
  Console.WriteLine("Content type is {0}", response.ContentType);
  </code></pre>