C# post一般处理程序网页 网页无法获得POST的数据,这是为啥呢?
程序端:
HttpHelper http = new HttpHelper();
//创建Httphelper参数对象
HttpItem item = new HttpItem()
{
URL = "http://localhost:29291/Handler1.ashx",//URL 必需项
Method = "post",//URL 可选项 默认为Get
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
Postdata =“111111”,//Post要发送的数据
};
//请求的返回值对象
HttpResult result = http.GetHtml(item);
网页:
string PostStr = context.Request["PostData"];
if (PostStr != null)
{
context.Response.Write(PostStr );
}
else
{
context.Response.Write("kong");
}