public async void RegenerateServerDate() { DateTime dateTime = new DateTime(); using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://localhost:8080"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //error message here HttpResponseMessage response = await client.GetAsync("api/servertime"); if (response.IsSuccessStatusCode) { //error message here string result = await response.Content.ReadAsStringAsync(); result = Regex.Replace(result, @"[A-Za-z\]""", ""); dateTime = DateTime.Parse(result); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)