4个回答
2013-07-28
展开全部
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);
req.Timeout = 15000; //超时时间
req.CookieContainer = new CookieContainer();
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
req.ContentType = "multipart/form-data";
WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream(), Encoding.UTF8);
sReturn = sr.ReadToEnd().Trim();
resp.Close();
sr.Close();
req.Timeout = 15000; //超时时间
req.CookieContainer = new CookieContainer();
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
req.ContentType = "multipart/form-data";
WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream(), Encoding.UTF8);
sReturn = sr.ReadToEnd().Trim();
resp.Close();
sr.Close();
2013-07-28
展开全部
GetResponse()方法
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-28
展开全部
一楼正确
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-28
展开全部
楼上正解。 不过你要获取数据包要干啥呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询