POST Requests on WP7

前端 未结 5 2133
傲寒
傲寒 2021-02-11 05:20

I\'ve been dying for about 6 hours trying to figure out how to make a regular POST request in WP7 , I tried the answers of similar questions posted here and on many other places

5条回答
  •  Happy的楠姐
    2021-02-11 06:04

    I recommend you to use the postclient. It is pretty simple. You just need to add reference to dll file into your project, and then write something like:

    public void authorize(string login, string password)
    {
        Dictionary parameters = new Dictionary();
        parameters.Add("command", "login");
        parameters.Add("username", login);
        parameters.Add("password", password);
    
        PostClient proxy = new PostClient(parameters);
        proxy.DownloadStringCompleted += (sender, e) =>
        {
            if (e.Error == null)
            {
                MessageBox.Show(e.Result);
            }
        };
        proxy.DownloadStringAsync(new Uri("http://address.com/service", UriKind.Absolute));
    }
    

提交回复
热议问题