你好版主
由于删广告时误删了的帖子,现在补上,入对各位网友造成不便,请谅解。并强烈鄙视乱发广告者。×háevnt.discuz.netº>èÈb3òW¥ ×háevnt.discuz.netº>èÈb3òW¥ 本次整合只针对NETSNS中的代码做了少许修改,完成了基本的和论坛同步注册,登×háevnt.discuz.netº>èÈb3òW¥ doopcl 发表于 2009/4/15 10:22:00 |
×háevnt.discuz.netº>èÈb3òW¥我也是和你这样做的,但是总会出现下面的这种错误,能不能帮我解决下看是什么原因,谢谢了
×háevnt.discuz.netº>èÈb3òW¥public static byte[] GetResponseBytes(string apiUrl, string method_name, string postData)
×háevnt.discuz.netº>èÈb3òW¥ {
×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥ HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(apiUrl);
×háevnt.discuz.netº>èÈb3òW¥ request.Method = "POST";
×háevnt.discuz.netº>èÈb3òW¥ request.ContentType = "application/x-www-form-urlencoded";
×háevnt.discuz.netº>èÈb3òW¥ request.ContentLength = postData.Length;
×háevnt.discuz.netº>èÈb3òW¥ request.Timeout = 20000;
×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥ HttpWebResponse response = null;
×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥ try
×háevnt.discuz.netº>èÈb3òW¥ {
×háevnt.discuz.netº>èÈb3òW¥ StreamWriter swRequestWriter = new StreamWriter(request.GetRequestStream());
×háevnt.discuz.netº>èÈb3òW¥ swRequestWriter.Write(postData);
×háevnt.discuz.netº>èÈb3òW¥ if (swRequestWriter != null)
×háevnt.discuz.netº>èÈb3òW¥ swRequestWriter.Close();
×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥ response = (HttpWebResponse)request.GetResponse();
×háevnt.discuz.netº>èÈb3òW¥ using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
×háevnt.discuz.netº>èÈb3òW¥ {
×háevnt.discuz.netº>èÈb3òW¥ return Encoding.UTF8.GetBytes(reader.ReadToEnd());
×háevnt.discuz.netº>èÈb3òW¥ }
×háevnt.discuz.netº>èÈb3òW¥ }
×háevnt.discuz.netº>èÈb3òW¥ finally
×háevnt.discuz.netº>èÈb3òW¥ {
×háevnt.discuz.netº>èÈb3òW¥ if (response != null)
×háevnt.discuz.netº>èÈb3òW¥ response.Close();
×háevnt.discuz.netº>èÈb3òW¥ }
×háevnt.discuz.netº>èÈb3òW¥ }
×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥×háevnt.discuz.netº>èÈb3òW¥ response = (HttpWebResponse)request.GetResponse();这里报错.基础连接已经关闭: 接收时发生错误。
×háevnt.discuz.netº>èÈb3òW¥