|
原来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"),
};
此时传输个给服务器一直报错,密码错误,求解释,本人新手
|
|