hello guys
is there any issue in this code , because i m getting 400 bad request error,
- public async Task<ActionResult> Index()
- {
- List<ModelHome> EmpInfo = new List<ModelHome>();
-
- 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("Authorization", "Bearer " + token);
- client.DefaultRequestHeaders.Add("Access-Key", AccessKey);
-
-
- //Sending request to find web api REST service resource GetAllEmployees using HttpClient
- HttpResponseMessage Res = await client.GetAsync("api/Fee/GetDetail?challan_number=4780415&branchCode=24&organizationUserId=445");
-
- //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;
-
- //Deserializing the response recieved from web api and storing into the Employee list
- EmpInfo = JsonConvert.DeserializeObject<List<ModelHome>>(EmpResponse);
-
- }
- //returning the employee list to view
- return View(EmpInfo);
- }
- }