c#中HttpWebRequest获取http源码出错
源代码如下,stringstrUrl=@"http://www.google.cn/webhp?source=g_cn";HttpWebRequestreq=(HttpW...
源代码如下,
string strUrl = @"http://www.google.cn/webhp?source=g_cn";
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(strUrl);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
req.Method = "POST";
req.Timeout = 10;
req.ContentType = "application/x-www-form-urlencoded";
Stream newStream = req.GetRequestStream();
始终运行到最后一句的Stream的时候出错,不知道为什么,请各位师兄指点 展开
string strUrl = @"http://www.google.cn/webhp?source=g_cn";
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(strUrl);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
req.Method = "POST";
req.Timeout = 10;
req.ContentType = "application/x-www-form-urlencoded";
Stream newStream = req.GetRequestStream();
始终运行到最后一句的Stream的时候出错,不知道为什么,请各位师兄指点 展开
展开全部
string strUrl = @"http://www.google.cn/webhp?source=g_cn";
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(strUrl);
req.Method = "POST";
req.Timeout = 10;
req.ContentType = "application/x-www-form-urlencoded";
Stream newStream = req.GetRequestStream();
//写完post数据再GetResponse
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(strUrl);
req.Method = "POST";
req.Timeout = 10;
req.ContentType = "application/x-www-form-urlencoded";
Stream newStream = req.GetRequestStream();
//写完post数据再GetResponse
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询