public static string GetHtmlTest(string URI) { string fullhtml = null; while (true) { try { HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URI); req.Method = "GET"; req.UserAgent = "Opera/9.25 (Windows NT 6.0; U; en)"; req.KeepAlive = true; req.Timeout = 6000000; HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); if (resp.StatusCode != HttpStatusCode.OK) //如果服务器未响应,那么继续等待相应 continue; StreamReader sr = new StreamReader(resp.GetResponseStream(), Encoding.UTF8); fullhtml = sr.ReadToEnd().Trim(); resp.Close(); sr.Close(); break; } catch (WebException e) { e.StackTrace.ToString(); System.Diagnostics.Trace.WriteLine(e.Message); if (true) continue; } } return fullhtml; }
下载说明
☉本站所有源码和资源均由站长亲自测试-绝对保证都可以架设,运营!
☉如源码和资源有损坏或所有链接均不能下载,请告知管理员,
☉本站软件和源码大部分为站长独资,资源购买和收集,放心下载!
☉唯一站长QQ:1004003180 [人格担保-本站注重诚信!]
☉购买建议E-mail:1004003180@qq.com 源码收购 E-mail:1004003180@qq.com
☉本站文件解压密码 【文章内都自带解压密码,每个密码不同!】