使用 Windows 手机将 Json 数据发送到服务器 [关闭]

Posted

技术标签:

【中文标题】使用 Windows 手机将 Json 数据发送到服务器 [关闭]【英文标题】:Send Json Data to server with Windows phone [closed] 【发布时间】:2013-07-18 17:08:14 【问题描述】:

我想以 json 格式将 web 请求中的数据 Json 发送到 web 服务并从服务器获取结果。很多方法..:p

请帮我找到解决办法。

【问题讨论】:

【参考方案1】:

您可以使用(例如)RestClient ftom restsharp

_restClient = new RestClient();
var request = new RestRequest(url)  Method = Method.POST ;
request.AddHeader("content-type", "application/json");
request.RequestFormat = DataFormat.Json;
request.AddParameter("json", YOUR_JSON, ParameterType.GetOrPost);
request.Timeout = DEFAULT_TIMEOUT;
_restClient.Timeout = Constants.DEFAULT_TIMEOUT;
_restClient.ExecuteAsync(request, response =>

           // check response here
);

【讨论】:

当我尝试显示响应内容长度时,结果 = 0

以上是关于使用 Windows 手机将 Json 数据发送到服务器 [关闭]的主要内容,如果未能解决你的问题,请参考以下文章