Arrays HttpWebRequest的HttpWebResponse的字节数组的字符数组返回;System.Net.HttpWebRequest“;

Arrays HttpWebRequest的HttpWebResponse的字节数组的字符数组返回;System.Net.HttpWebRequest“;,arrays,httpwebrequest,httpwebresponse,Arrays,Httpwebrequest,Httpwebresponse,我正在尝试使用WebRequest.GetResponse()请求网页;并将该响应转换为字符数组,这样我就可以对数组进行排序并获得页面上的任何HREF标记。问题是,在我的代码中的某个地方,响应变成了“System.Net.HttpWebRequest”,而不是应该从页面检索的HTML 获取字符数组的代码: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlTextBox.Text); request

我正在尝试使用WebRequest.GetResponse()请求网页;并将该响应转换为字符数组,这样我就可以对数组进行排序并获得页面上的任何HREF标记。问题是,在我的代码中的某个地方,响应变成了“System.Net.HttpWebRequest”,而不是应该从页面检索的HTML

获取字符数组的代码:

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);
用于搜索链接的代码(注释用于疑难解答):

for(int i=0;i