Click here to Skip to main content
15,895,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

how can i call method post from c# with out using Route

C#
[Route("post1")]
[HttpPost]
public HttpResponseMessage Post(List<Obj> _lstvalue)
 {                returnControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError);
}

[Route("post2")]
[HttpPost]
public HttpResponseMessage PostList (List<Dictionary<string,string>> _ListDataDict)
 {                returnControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError);
}


in My c# code to call this method i used
using (HttpClient client = new HttpClient())
response = client.PostAsJsonAsync("http://localhost:1523/Post1[^]", SMSList).Result;
return response.Content.ReadAsAsync<string>().Result;
i need to remove POST1 And POST2 from URI
Posted
Updated 22-Apr-15 23:25pm
v5

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900