public string GetData() { NetworkCredential networkCredential = new NetworkCredential("bojjaiah.thoti", "pass@word1", "testserver"); using (var client = new HttpClient(new HttpClientHandler() { UseDefaultCredentials = true, Credentials = networkCredential, PreAuthenticate = true })) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; }); Uri uri = new Uri("http://10.10.10.52:7148/DynamicsNav1/OData/"); client.BaseAddress = uri; client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); string clarity_URL = "http://10.10.10.52:7148/DynamicsNav1/OData/ShopFloorTaskList"; var response = client.GetAsync(clarity_URL).Result; string responseString = response.Content.ReadAsStringAsync().Result; Response.Write(responseString); return responseString; } }
UseDefaultCredentials = true
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)