|
HttpItem item = new HttpItem()
{
URL = url,//URL 必需项
Method = "POST",//URL 可选项 默认为Get
ContentType = "text/json",//返回类型 可选项有默认值
PostDataType= PostDataType.String,
Postdata = "a = 123 & c = 456 & d = 789&sysTime = 20180313112257",
ResultCookieType = ResultCookieType.CookieCollection,
CookieCollection = Form1.GetCookieCollection(),
Allowautoredirect = true,//加不加其实关键看你的地址是否会跳转的,如果不会跳就不用加,可能你的地址不 是最终地址的原因
};
这么写的,就是服务器网页收到数据是null,
//写入字符串
else if (!string.IsNullOrWhiteSpace(item.Postdata))
{buffer = postencoding.GetBytes(item.Postdata);}if (buffer != null){request.ContentLength = buffer.Length;request.GetRequestStream().Write(buffer, 0, buffer.Length);}都能正常看到发送数据的值 ,为什么网页却受到的是null?
|
|