문제

PostVar "데이터"에 응답하는 웹 서비스에 도달해야합니다. httprequest와 함께 C# 에서이 이름을 어떻게 설정합니까? 이것이 내가 얻은 것입니다.

            UTF8Encoding encoding = new UTF8Encoding();
            byte[] data = encoding.GetBytes(postData); 

            HttpWebRequest myRequest =
              (HttpWebRequest)WebRequest.Create("http://secreturl/jubidubb.php");
            myRequest.Method = "POST";
            myRequest.ContentType = "application/x-www-form-urlencoded";
            myRequest.ContentLength = data.Length;
            myRequest.KeepAlive = true;
            Stream newStream = myRequest.GetRequestStream();


            newStream.Write(data, 0, data.Length);
            newStream.Close();

            // The response
            WebResponse response = myRequest.GetResponse();
도움이 되었습니까?

해결책

그렇지 않습니다 PostVar "데이터"에 응답합니다. 단순히 당신을 의미합니다 postData 문자열은 형식이어야합니다 "data=mydata"?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top