44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
namespace CommonConsole
|
|
{
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
public class Program
|
|
{
|
|
private static readonly HttpClient httpClient = new HttpClient();
|
|
|
|
public static void Main()
|
|
{
|
|
Task.Factory
|
|
.StartNew(async () =>
|
|
{
|
|
using (var httpRequestMessage = new HttpRequestMessage())
|
|
{
|
|
httpRequestMessage.Content = new StringContent("{}", Encoding.UTF8, "application/json");
|
|
httpRequestMessage.Method = HttpMethod.Post;
|
|
httpRequestMessage.RequestUri = new Uri("http://localhost:52822/LaaProductionWeb/api/Login/AD");
|
|
|
|
using (var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage))
|
|
{
|
|
Console.WriteLine(httpResponseMessage);
|
|
|
|
using (var httpContent = httpResponseMessage.Content)
|
|
{
|
|
var content = await httpContent.ReadAsStringAsync();
|
|
var obj = JsonConvert.DeserializeObject(content);
|
|
|
|
Console.WriteLine(JsonConvert.SerializeObject(obj, Formatting.Indented));
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
}
|