KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
On the controller Put is as following: [HttpPut] [ActionName("putname")] public JsonResult putname(string name) { var response = ... return Json(response); } The issue is on the when consuming this API via following using (httpClient = new HttpClient()) { string name = "abc"; string jsonString = JsonConvert.SerializeObject(name); var requestUrl = new Uri("http:...../controller/putname/"); using (HttpContent httpContent = new StringContent(jsonString)) { httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = httpClient.PutAsync(requestUrl, httpContent).Result; } This code doesn't pass the parameter name to controller. I even tried changeing uri to /putname/" + name.
Tags (comma-separated)
Save Edits
Cancel