public class GlobalVariables { public static HttpClient client = new HttpClient(); public GlobalVariables() { client.BaseAddress = new Uri("http://localhost:8080"); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/xml")); } }
[HttpGet] public ActionResult GetById() { IEnumerable<StudentViewModel> list; HttpResponseMessage response = GlobalVariables.client.GetAsync("/System_Users").Result; list = response.Content.ReadAsAsync<IEnumerable<StudentViewModel>>().Result; return View(list); }
System.InvalidOperationException: 'An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set.'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)