Skip to content

Instantly share code, notes, and snippets.

@lmatt-bit
Created June 4, 2014 05:52
Show Gist options
  • Select an option

  • Save lmatt-bit/6f46b20f0d0cf2cd843a to your computer and use it in GitHub Desktop.

Select an option

Save lmatt-bit/6f46b20f0d0cf2cd843a to your computer and use it in GitHub Desktop.
httpclient post with ntlm auth
HttpClientHandler handler = new HttpClientHandler();
handler.UseDefaultCredentials = true;
using(var client = new HttpClient(handler)) {
var content = new FormUrlEncodedContent(new[] {
new KeyValuePair<string, string>("query", "test"),
new KeyValuePair<string, string>("position", "top")
});
var result = client.PostAsync("http://url/", content).Result;
Console.WriteLine(result.Content.ReadAsStringAsync().Result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment