有这样的代码:
var client = new HttpClient();
var postData = new List<KeyValuePair<string, string>>();
postData.Add(new KeyValuePair<string, string>("username:", " 1"));
postData.Add(new KeyValuePair<string, string>("password:", " 1"));
HttpContent content = new FormUrlEncodedContent(postData);
HttpResponseMessage response = await client.PostAsync(
"http://libdiary.liberty-lab.ru/api/v1/login",
content);
string result = await response.Content.ReadAsStringAsync();
return result;
他必须向服务器发出post请求。这个项目是windows phone。 服务器上负责此查询的功能如下(Python):
^{pr2}$但是,尝试访问windows phone时总是使用error:INTERNAL SERVER ERROR
,并且在应用程序代码中返回带有error on this page的http页面。你能告诉我是什么问题吗?也许我发送数据是错误的,你能建议如何做的正确吗?在
您试图访问名为
HTTP_USERNAME
和HTTP_USERNAME
的键上的request
对象,这些键不存在。在呼叫站点或目标站点更改它们:我解决了问题。服务器检查邮件头中的用户名和密码。我只添加了一个新的标题“username”和新的头“password”,并为它们分配适当的值。在
谢谢你的帮助,尤其是尤瓦尔·伊扎科夫。在
相关问题 更多 >
编程相关推荐