如何在一个HTTPRequest,设置postvar的名字?
-
22-07-2019 - |
题
我需要到达其响应postvar“数据”的web服务。 如何设置在C#这个名字与一个HTTPRequest,... 这是我得到了什么:
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"
的?
不隶属于 StackOverflow