【问题标题】:windows phone sending values with http client GET methodwindows phone 使用 http 客户端 GET 方法发送值
【发布时间】:2013-12-24 15:40:33
【问题描述】:

我已经使用 POST 方法管理发送值,如下所示。

 var values = new List<KeyValuePair<string, string>>
        {
            new KeyValuePair<string, string>("username", "user"),
            new KeyValuePair<string, string>("password", "password"),
        }; var client = new HttpClient(new HttpClientHandler());

        HttpResponseMessage response = await client.PostAsync("URL", new FormUrlEncodedContent(values));

但是现在我发送请求的方法是 GET,我需要发送像 POST 这样的值来获取响应,否则它会返回错误。 任何人都可以帮助如何使用 GET 方法发送值吗? 谢谢。

【问题讨论】:

    标签: c# windows-phone-8 http-get dotnet-httpclient


    【解决方案1】:

    简单的呢

    var response = await client.GetAsync("URL?username=user&password=password");
    

    ?

    【讨论】:

    • 是的,它有效:P 我是 httpClient 库和东西的新手。非常感谢:D
    猜你喜欢
    • 2019-03-31
    • 1970-01-01
    • 2013-01-18
    • 1970-01-01
    • 2016-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多