HttpWebRequest请求超时异常的处理方法(重新发送请求到成功为止)
摘要:
方法主要有2点:1.在GetResponse()超时后要重新发送请求;2.检查是否异常,捕获或抛掉异常。publicstring GetHtml(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.Ke... 阅读全文
posted @ 2012-09-23 00:12 Jason_liu 阅读(9007) 评论(0) 推荐(0) 编辑