求助:模拟POST网站登录的错误!
朋友用易语言模拟了个登录..我截取数据..用C#模拟..发送的POST数据请求头完全一样..可是我写的却无法接收到返回信息易语言写的却正常..第一张图是正常的数据图..第二张是我C#写的发送的数据图..发回404连接中断
--------------------编程问答-------------------- // 获取响应
private void Verification(string nameString, string pwdString, string proxyString)
{
string sURL = "http://q11.3g.qq.com/g/s";
string postData = "u=" + 号码+ "&p=" + 密码+ "&modifySKey=0&aid=nLoginHandle";
byte[] data = Encoding.UTF8.GetBytes(postData);
// 创建一个URL请求
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sURL);
request.Method = "POST";
request.Headers.Add("Accept-Language", "zh-cn");
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
request.Accept = "*/*";
request.UserAgent = "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)";
request.ServicePoint.Expect100Continue = false;
// Send the data.
Stream dataStream = request.GetResponse();
dataStream.Write(data, 0, data.Length);
// 获取响应
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// 获取流包含由服务器返回的内容。
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
// 保存返回
responseFromServer = reader.ReadToEnd();
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
这步报错"基础连接已经关闭: 接收时发生错误。" --------------------编程问答--------------------
--------------------编程问答--------------------
Stream dataStream = request.GetRequestStream();
dataStream.Write(data, 0, data.Length);
dataStream.Close();
还是报错..是不是接收返回数据对象没用对... --------------------编程问答-------------------- 补发下图
[img=http://soft.im520.com/attachment.php?aid=MTMxfGI5OWMyM2VlfDEyNjA4NjQ0Nzh8ZTFhNVhXeXNUR01BaDZCS0tUWk0vaW9XNmpldDJMWUp5RmlBQ1BxSlFDOEc5akE%3D&noupdate=yes][/img]
[img=http://soft.im520.com/attachment.php?aid=MTMwfGNhYzNlMmExfDEyNjA4NjQ0Nzh8ZTFhNVhXeXNUR01BaDZCS0tUWk0vaW9XNmpldDJMWUp5RmlBQ1BxSlFDOEc5akE%3D&noupdate=yes][/img]
补充:.NET技术 , C#