response.content.readasasync returns always null help please :)) What I have tried: <pre> public class ResultData { public string Name { get; set; } public List<Bank> RresultObject { get; set; } public string UUId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string address { get; set; } public string tel { get; set; } public string Marital_status { get; set; } public string Occupation { get; set; } public string PayIN { get; set; } }
<pre> static async Task CallWebAPIAsync() { try { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:35799/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //GET Method HttpResponseMessage response = await client.GetAsync("bank"); if (response.IsSuccessStatusCode) { // here always null <-<-<- ResultData department = await response.Content.ReadAsAsync<ResultData>(); } } Console.Read(); } catch (Exception ex) { throw ex; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)