有人碰到过webrequest.timeout设置无效的问题吗?
protected static string GetHttpData(string url) { StreamReader sr = null; string str = ""; try { WebRequest temp = WebRequest.Create(url); temp.Timeout = 1000; //读取 WebResponse myTemp = temp.GetResponse(); sr = new StreamReader(myTemp.GetResponseStream(), System.Text.Encoding.GetEncoding("gb2312")); str = sr.ReadToEnd(); } catch { return "-1"; } return str; }