• POST以文件流的方式发送 和接收


    以文件流的方式发送 和接收

          postData += ("&hashcode=" + GetMD5String(pwd));
                //byte[] data = encoding.GetBytes(postData);
                byte[] data = System.Text.Encoding.UTF8.GetBytes(postData);

                // Prepare web request...
                HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("url");
                myRequest.Method = "POST";
                myRequest.ContentType = "application/x-www-form-urlencoded";
                myRequest.ContentLength = data.Length;
                Stream newStream = myRequest.GetRequestStream();
                // 发送数据
                newStream.Write(data, 0, data.Length);
                newStream.Close();
                // 接收
                HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
                StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
                string content = reader.ReadToEnd();

  • 相关阅读:
    shell 函数
    使用Alpine镜像构建镜像
    macos修改vmware Fusion的NAT网络
    K8s Pod与宿主机时区不同步
    nginx热升级
    awk分析web日志
    k8s 新建用户远程连接集群和context切换
    查询出口公网ip
    微服务之服务网格 Istio
    Systemd 、systemctl进程管理工具
  • 原文地址:https://www.cnblogs.com/wujianfeng/p/3412891.html
Copyright © 2020-2023  润新知