C# post提交数据时后台接收方法

  public ActionResult PushWeatherInfoSecond()
        {
              try
                {
                    HttpContext.Response.ContentType = "application/json";
                    HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    using (var reader = new System.IO.StreamReader(HttpContext.Request.InputStream))
                    {
                        String data = reader.ReadToEnd();//data是post传过来的数据
                        System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "/log" + DateTime.Now.ToString("yyyyMMdd") + "type2" + ".log",
                                            DateTime.Now + " data :  " + data + "\r\n");
                        if (!string.IsNullOrEmpty(data))
                        {
                            
                        }
                    }
                    return Json(new { retcode = 10009, text = "参数不能为空", value = "" }, JsonRequestBehavior.AllowGet);
                }
                catch (Exception ex)
                {
                   
                }
        }
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。