0

In my Web Api I have two controllers and each controller I have one get method and one post method. In get method it's working perfectly but in post method it's not working and throwing this error,

{"Message":"The requested resource does not support http method 'GET'."}

This is my source code

Basanta Matia
  • 1,504
  • 3
  • 15
  • 27
  • I think you should put the code in the post (as as image). – Ignatius Jul 11 '17 at 05:08
  • Refer this https://stackoverflow.com/a/11006454/795683 – Sain Pradeep Jul 11 '17 at 05:19
  • this is my routing for both method config.Routes.MapHttpRoute( name: "Sales", routeTemplate: "api/{Sales}/{jsonresponce}", defaults: new { controller = "Sales", action = "Postsomething" } ); config.Routes.MapHttpRoute( name: "User", routeTemplate: "api/{User}/{GetDetails}", defaults: new { controller = "User", action = "GetDetails" } ); – Umair Malik Jul 11 '17 at 05:21
  • Your action method in Sales controller says "PostSomething" Have you put [HttpPost] attribute over it? And what are you trying to do with that method? If it's not getting anything from a source,then probably the error would come. – Amit Mishra Jul 11 '17 at 06:02
  • yes i have added the attribute.... error is coming in get method bhai.... – Umair Malik Jul 11 '17 at 06:31
  • can you show the code for both these methods? – Amit Mishra Jul 11 '17 at 07:05
  • you can check out this link https://stackoverflow.com/questions/11005788/asp-net-web-api-the-requested-resource-does-not-support-http-method-get. Hope it helps – Amit Mishra Jul 11 '17 at 07:08

0 Answers0