我试图用我的 windows phone 在网络服务器上发出请求,但我不工作。
我有这段代码可以在我的电脑上运行
var client = new WebClient
{
BaseAddress = "https://xxx.xxx-xxx.com/"
};
var values = new NameValueCollection
{
{"wrap_name", userName},
{"wrap_password", password},
{"wrap_scope", scope}
};
// WebClient takes care of URL Encoding
var responseBytes = client.UploadValues("issue/wrap", "POST", values);
我知道 client.UploadValues 在 windows phone 上不可用。所以我在我的 wp 上做了这个代码
var email = "xxx@xxx.org";
var password = "xxx";
var data = "wrap_name=" + email + "&wrap_password=" + password + "&wrap_scope=http://xxx.com/";
var url = "https://xxx.xxx-xxx.com/issue/wrap";
var wc = new WebClient {
//BaseAddress = "https://login.solar-inverter.com/"
};
var URI = new Uri(url);
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc__UploadStringCompleted);
wc.UploadStringAsync(URI, "POST", data);
我使用提琴手,我得到了这个
谁能帮我
提前致谢