title: Char Array of Byte Array of HttpWebResponse of HttpWebRequest returns "System.Net.HttpWebRequest"
body: <p>I'm trying to request a webpage using WebRequest.GetResponse(); and convert that response to a chararray, so I can sort through the array and get any HREF tags that are on the page. The problem is, somewhere in my code the response turns into "System.Net.HttpWebRequest", instead of the HTML that should be retrieved from the page.  </p>
  
  <p>The code to get the char array:  </p>
  
  <pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlTextBox.Text);
              request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7";
              HttpWebResponse response = (HttpWebResponse)request.GetResponse();
              System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
              bytearray = encoding.GetBytes(Convert.ToString(response));
              chararray = encoding.GetChars(bytearray);
  </code></pre>
  
  <p>The code to search for links (commented for troubleshooting):  </p>
  
  <pre><code>for (int i = 0; i &lt; chararray.Length; i++)
  {
      // Get all HREFs
      if (i &lt; 500 &amp; chararray[i] == 'h' &amp; chararray[i + 1] == 'r' &amp; chararray[i + 2] == 'e' &amp; chararray[i + 3] == '=' &amp; chararray[i + 4] == '"')
      {
          for (int tempi = 0; bytearray[i + 4 + tempi] != '"';)
          {
               tempstring = tempstring + chararray[i + 4 + tempi].ToString();
          }
          urlarray[urlarray.Length + 1] = tempstring;
          i = i + 4;
      }
  }
  scrapeLink1.Text = urlarray[1];
  </code></pre>
  
  <p>If I missed something, or more information is needed, let me know.</p>