我正在使用HttpWebRequest来阅读网站上的内容。
string url = "http://google.com.vn";
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Timeout = 2000;
request.Method = WebRequestMethods.Http.Get;
request.ReadWriteTimeout = 2000;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
但是超时不起作用:(。我可以使用backgroundworker来暂停。