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

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

请帮我找到解决办法。

【问题讨论】:

    标签: windows-phone json.net jsonserializer


    【解决方案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
    猜你喜欢
    • 2012-11-28
    • 1970-01-01
    • 1970-01-01
    • 2014-04-27
    • 1970-01-01
    • 2016-03-08
    • 2021-10-15
    • 1970-01-01
    • 2013-11-22
    相关资源
    最近更新 更多