public void HttpClientPost()
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(this.txtUrl.Text);
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>(“loginName”, “name”),
new KeyValuePair<string, string>(“psw”, “psw”),
});
var result = client.PostAsync(this.txtUrl2.Text, content).Result;
string resultContent = result.Content.ReadAsStringAsync().Result;
Console.WriteLine(resultContent);
}
}