命名空间using System.Net;
代码语言:javascript复制 public static string GetResponse(string reqString)
{
string result = "";
WebRequest req = WebRequest.Create(reqString);
req.ContentType = "text/html; charset=UTF-8";
WebResponse res = req.GetResponse();
Stream stream = res.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))//Encoding.GetEncoding("gb2312")
{
result = reader.ReadToEnd();
}
return result;
}