string Url = ConfigurationManager.AppSettings["DataUrl"];
DateTime trndate = DateTime.Now.Date;
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(Url);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.GetAsync(Url +"?id="+ trndate.ToString("yyyy-MM-dd")).Result;
Above method worked Successfully but post method not worked.My Post method Calling Code is.
HttpClient Postclient = new HttpClient();
Postclient.BaseAddress = new Uri(Url);
Postclient.DefaultRequestHeaders.Accept.Clear();
Postclient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
PostRemote rr = new PostRemote();
rr.id= 123;
rr.age= 38;
HttpResponseMessage postresponse = Postclient.PostAsJsonAsync(Url, rr).Result;
An exception occrued Error message is
"Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.**