MVC Control 接收post请求的json数据

 [HttpPost]
        public string QueryInvoice()
        {
            string stream;
            using (var sr = new StreamReader(Request.InputStream))
            {
                stream = sr.ReadToEnd();
            }
            JavaScriptSerializer js = new JavaScriptSerializer();
            QueryInfo info = js.Deserialize<QueryInfo>(stream);
            if (info == null)
            {
                return “请输入正确参数”;
            }
        }


 public class QueryInfo
    {
        public string caseNumber { get; set; }
        public string picture { get; set; }
    }
View Code

 

posted on 2018-11-07 14:39  lovezj9012  阅读(591)  评论(0编辑  收藏  举报

导航