111,098
社区成员




string uri = " http://server/path/WebForm.aspx";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
req.Method = "GET";
req.MaximumAutomaticRedirections = 3;
req.Timeout = 5000;
Console.WriteLine("Sending HTTP request");
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
Stream resst = res.GetResponseStream();
StreamReader sr = new StreamReader(resst);
Console.WriteLine("HTTP Response is: ");
Console.WriteLine(sr.ReadToEnd());
sr.Close();
resst.Close();
string strURL = "http://localhost/xxxx/xxxx.aspx?keyword=";
strURL +=this.textBox1.Text;
System.Net.HttpWebRequest request;
//创建一个HTTP请求
request = (System.Net.HttpWebRequest)WebRequest.Create(strURL);
//request.Method="get";
System.Net.HttpWebResponse response;
response = (System.Net.HttpWebResponse)request.GetResponse();
System.IO.Stream s;
s = response.GetResponseStream();
XmlTextReader Reader = new XmlTextReader(s);
Reader.MoveToContent();
string strValue = Reader.ReadInnerXml();
strValue = strValue.Replace("<","<");
strValue = strValue.Replace(">",">");
MessageBox.Show(strValue);
Reader.Close();