zoukankan      html  css  js  c++  java
  • C#使用post方式提交json数据

    //地址
                string _url = "https://www.dXXXayup.ink/api/User/Login";
                //json参数
                string jsonParam = "{ phonenumber:"18665885202",pwd:"tsp"}";
                var request = (HttpWebRequest)WebRequest.Create(_url);
                request.Method = "POST";
                request.ContentType = "application/json;charset=UTF-8";
                byte[] byteData = Encoding.UTF8.GetBytes(jsonParam);
                int length = byteData.Length;
                request.ContentLength = length;
                Stream writer = request.GetRequestStream();
                writer.Write(byteData, 0, length);
                writer.Close();
                var response = (HttpWebResponse)request.GetResponse();
                var responseString = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")).ReadToEnd();
                MessageBox.Show(responseString.ToString());
  • 相关阅读:
    Html中常用的属性
    vue-页面回退
    vue-watch
    html
    Html-列表
    vue项目中px自动转换为rem
    vuex使用
    localStorage的使用
    slot
    模糊查询
  • 原文地址:https://www.cnblogs.com/niyl/p/11216707.html
Copyright © 2011-2022 走看看