我有这样的代码在C#:c#中的getResponse不起作用。无响应回来
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.ContentType = "application/x-www-form-urlencoded";
request.Timeout = 30000;
request.Method = "POST";
request.KeepAlive = true;
request.AllowAutoRedirect = false;
Stream newStream = request.GetRequestStream();
newStream.Write(bPostData, 0, bPostData.Length);
byte[] buf = new byte[1025]; int read = 0; string sResp = "";
HttpWebResponse wResp = (HttpWebResponse)request.GetResponse();
Stream resp = wResp.GetResponseStream();
线HttpWebResponse wResp =...
刚刚挂起(在没有从URL响应)。我不确定究竟是在哪里崩溃(因为我甚至没有发生异常错误)。我在IE中测试了URL,它工作正常。我也检查了bPostData,并且其中有数据。 哪里出问题了?
是什么'url'样子? – 2011-05-23 20:00:21
你等了30多秒? – 2011-05-23 20:00:42
http://test.abc.com/newtest ..普通网址 – askeei 2011-05-23 20:01:06