标签:empty ict cti ext eva byte close ret 写入
POST - 向指定的资源提交要被处理的数据
1.什么是WebAPI,详见:http://www.cxyclub.cn/n/25123/
/// <summary>
/// 获取post过来的数据
/// </summary>
/// <returns>返回解析的参数和值</returns>
[HttpPost]
private string GetResponseVal()
{
SortedDictionary<object, object> sorted = new SortedDictionary<object, object>();
var request = HttpContext.Current.Request;
Stream resStream = request.InputStream;
int len = (int)resStream.Length;//post数据长度
string res = string.Empty;
if (len != 0)
{
byte[] inputByts = new byte[len];//字节数据,用于存储post数据
resStream.Read(inputByts, 0, len);//将post数据写入byte数组中s
resStream.Close();
res = Encoding.UTF8.GetString(inputByts);//转为UTF8编码
}
return res;
}
标签:empty ict cti ext eva byte close ret 写入
原文地址:https://www.cnblogs.com/xuleizi/p/9076508.html