public async Task user() { string pathurl = Request.QueryString["pAuthURLParams"].ToString(); string[] authParams = pathurl.Split('&'); string authParamsSessionID = authParams[0].Split('=')[1]; string authParamsToken = authParams[1].Split('=')[1]; using (var client = new HttpClient()) { //Passing service base url client.BaseAddress = new Uri(Baseurl); client.DefaultRequestHeaders.Clear(); //Define request data format client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("Access-Control-Allow-Origin", "*"); client.DefaultRequestHeaders.Add("Access-Control-Allow-Headers", "*"); client.DefaultRequestHeaders.Add("sessionID", authParamsSessionID); client.DefaultRequestHeaders.Add("token", authParamsToken); //Sending request to find web api REST service resource GetAllEmployees using HttpClient HttpResponseMessage Res = await client.GetAsync("api/StateVerification/GetProfile"); //Checking the response is successful or not which is sent using HttpClient if (Res.IsSuccessStatusCode) { //Storing the response details recieved from web api var EmpResponse = Res.Content.ReadAsStringAsync().Result; } } //Hosted web API REST Service base url return View(); }