MVC 怎么获得POST过来的数据
1个回答
展开全部
它们发送的是XML数据,不是键值对形式的,所以才要这样获取:
if (Request.HttpMethod.ToLower() == "post")
2 {
3 Stream s = System.Web.HttpContext.Current.Request.InputStream;
4 byte[] b = new byte[s.Length];
5 s.Read(b, 0, (int)s.Length);
6 postStr = Encoding.UTF8.GetString(b);
7 if (!string.IsNullOrEmpty(postStr))
8 {
9 ResponseMsg(postStr);
10 }
11 //WriteLog("postStr:" + postStr);
12 }
if (Request.HttpMethod.ToLower() == "post")
2 {
3 Stream s = System.Web.HttpContext.Current.Request.InputStream;
4 byte[] b = new byte[s.Length];
5 s.Read(b, 0, (int)s.Length);
6 postStr = Encoding.UTF8.GetString(b);
7 if (!string.IsNullOrEmpty(postStr))
8 {
9 ResponseMsg(postStr);
10 }
11 //WriteLog("postStr:" + postStr);
12 }
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询