请求return空手机号码

Request return null mobile number

我在 Postman 中有代码 运行ning 但是当我在 c# 中尝试时它不是 运行 和 return 错误 801 这意味着手机号码为空,但它不是空的并且同样 运行ning 在 Postman 中工作正常:我 运行 来自本地主机,此代码将 运行 来自桌面应用程序

我的代码:

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
        
        var postData = "username=xxxxx&password=xxxxx&sender= salon&language=1&Mobile=000000000&message=test4444";              
        
            
        string Url = "https://smsmisr.com/api/webapi/?";
        HttpWebRequest myHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create(Url);
        
        

        myHttpWebRequest.Method = "POST";

        byte[] data = Encoding.ASCII.GetBytes(postData);
        
        
        myHttpWebRequest.ContentType = "application/jsonn";
        //myHttpWebRequest.Accept = "application/json";
        
        myHttpWebRequest.ContentLength = data.Length;

        Stream requestStream = myHttpWebRequest.GetRequestStream();
        requestStream.Write(data, 0, data.Length);
        requestStream.Close();

        HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();

        Stream responseStream = myHttpWebResponse.GetResponseStream();

        StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default);

        this.Label16.Text = myStreamReader.ReadToEnd();

        
        myStreamReader.Close();
        responseStream.Close();

        myHttpWebResponse.Close();

您的内容类型是 json,但您传递的是查询字符串作为负载。为什么不捆绑此有效负载?

{
  "username": "xxxxx",
  "password": "xxxxx",
  "sender": "salon",
  "language": 1,
  "Mobile": "000000000",
  "message": "test4444"
}