部分代码如下:
CookieContainer cookieContainer = new CookieContainer(); HttpWebRequest request = WebRequest.Create(formUrl) as HttpWebRequest; request.Method = "GET"; request.KeepAlive = false; request.AllowAutoRedirect = true; request.ContentType = "application/x-www-form-urlencoded"; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"; request.CookieContainer = cookieContainer; HttpWebResponse SendSMSResponse = (HttpWebResponse)request.GetResponse(); //调试的时候提示远程服务器没有响应,程序自动中断了 StreamReader SendSMSResponseStream = new StreamReader(SendSMSResponse.GetResponseStream()); string strRespone = SendSMSResponseStream.ReadToEnd(); 如何判断远程服务器没有响应,不要继续执行?