苏飞论坛
标题:
求助帖子
[打印本页]
作者:
hxiaohua
时间:
2016-3-30 21:44
标题:
求助帖子
原来C#:
string postData = string.Format("username={0}&password={1}", "hxh", "hxh";
//这里按照前面FireBug中查到的POST字符串做相应修改。
byte[] postdatabyte = Encoding.UTF8.GetBytes(postData);
request.ContentLength = postdatabyte.Length;
using (Stream stream = request.GetRequestStream())
{
stream.Write(postdatabyte, 0, postdatabyte.Length);
}
可以实现:post数据给服务器
后面用httphelp以后:
HttpItem item = new HttpItem()
{
URL = "http://service.swu.edu.cn/fee/remote_logout2.jsp",//URL 必需项
Timeout = 1000,
Encoding = System.Text.Encoding.GetEncoding("gb2312"),//URL 可选项 默认为Get
Method = "post",//URL 可选项 默认为Get
ReadWriteTimeout = 2000,//写入Post数据超时时间 可选项默认为30000
PostEncoding = Encoding.UTF8,
Postdata = string.Format("username={0}&password={1}", "hxh", "hxh"),
};
此时传输个给服务器一直报错,密码错误,求解释,本人新手
作者:
站长苏飞
时间:
2016-3-31 11:47
提供下抓包数据,是不是头信息写错了。
http://tool.sufeinet.com/HttpHelper.aspx
在线做下测试
作者:
hxiaohua
时间:
2016-4-19 18:28
嗯嗯,头信息错了,谢谢啦
欢迎光临 苏飞论坛 (http://www.sufeinet.com/)
Powered by Discuz! X3.4