美文网首页
C# post提交数据时后台接收方法

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

作者: 飞天猪Pony | 来源:发表于2020-09-14 17:02 被阅读0次
      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)
                    {
                       
                    }
            }
    

    相关文章

      网友评论

          本文标题:C# post提交数据时后台接收方法

          本文链接:https://www.haomeiwen.com/subject/eabzektx.html