/// <summary> /// 默认的编码:UTF8 /// </summary> public Encoding _encoding = Encoding.UTF8; /// <summary> /// 返回Html /// </summary> public string returnHtmlData = ""; /// <summary> /// 返回错误信息 /// </summary> public string returnErrorData = ""; private string _url; /// <summary> /// 生成html /// </summary> private void GetHttpRequestString() { try { System.Net.WebRequest wReq = System.Net.WebRequest.Create(_url); System.Net.WebResponse wResp = wReq.GetResponse(); System.IO.Stream respStream = wResp.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(respStream, _encoding); returnHtmlData = reader.ReadToEnd(); } catch (System.Exception ex) { returnErrorData += ex.Message; } }