本人开发平台wince,开发软件vs2005.最近想在wince上发送请求到服务器,但是服务器却接收不到我的post数据,我的代码如下: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(Url)); byte[] Eparam = Encoding.ASCII.GetBytes(postDATE); // 转化
MessageBox.Show(Encoding.ASCII.GetString(Eparam, 0, Eparam.Length)); request.Method = "post";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = Eparam.Length; Stream questStream = null;
try
{
questStream = request.GetRequestStream();
questStream.Write(Eparam, 0, Eparam.Length);
questStream.Flush();
}
//处理异常
catch (Exception ex)
{
return ex.Message.ToString();
}
finally
{
questStream.Close();
}
请求大侠。告知原因。
MessageBox.Show(Encoding.ASCII.GetString(Eparam, 0, Eparam.Length)); request.Method = "post";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = Eparam.Length; Stream questStream = null;
try
{
questStream = request.GetRequestStream();
questStream.Write(Eparam, 0, Eparam.Length);
questStream.Flush();
}
//处理异常
catch (Exception ex)
{
return ex.Message.ToString();
}
finally
{
questStream.Close();
}
请求大侠。告知原因。
request.Method = "post";
请求方式post是小写的,改成大写,就没有问题了,我晕死。来接分吧