C# Windows phone 8 Http客户端-发布数据

C# Windows phone 8 Http客户端-发布数据,c#,http,windows-phone,C#,Http,Windows Phone,我正在开发一个WindowsPhone8应用程序。我需要使用HTTP POST方法发送一些数据,但它不起作用: 这是我的密码: public async Task<bool> ConnexionPage() { bool _verif = false; var client = new HttpClient(); string data = "username=" + this.user + "&password="

我正在开发一个WindowsPhone8应用程序。我需要使用HTTP POST方法发送一些数据,但它不起作用:

这是我的密码:

 public async Task<bool> ConnexionPage()
    {
        bool _verif = false;
        var client = new HttpClient();
        string data = "username=" + this.user + "&password=" + this.password + "&cmdweblogin=Enter";
        var postContent = new StringContent(data, Encoding.UTF8, "application/x-www-form-urlencoded");

        // send request asynchronously and continue when complete 
        var response = await client.PostAsync("http://intranet.ifips.u-psud.fr/ii/index.php?id=571", postContent).ConfigureAwait(continueOnCapturedContext: false); 

        // check that response was successful or throw exception response.EnsureSuccessStatusCode();
        response.EnsureSuccessStatusCode();
        //Read the JSON response
        var content = await response.Content.ReadAsStringAsync();
        _verif=true;
        return _verif;
    }

当我使用断点时,我在第行被阻塞:var response=await client.PostAsyn…

您是否剪切而不是复制var response=await client.PostAsyn?是的,我更正了它…很难说什么,因为这应该可以正常工作。你要等多久才能完成?你能检查你的网络流量以确认你没有收到响应吗?当我使用void而不是Task时,这就是工作。。。但如果我使用Task,它会在var响应等待客户端之后被阻止……好的,经过一些研究,我发现使用Task.Result调用http客户端会阻止该方法。