Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have the following Controller code:

C#
namespace PlatypusReports.Controllers
{
    [RoutePrefix("api/platypus")]
    public class PlatypusController : ApiController
    {
        [Route("{unit}/{begindate}")]
        [HttpPost]
        public void Post(string unit, string begindate)
        {
            . . .
        }

        [Route("{unit}/{begindate}")]
        [HttpGet]
        public string Get(string unit, string begindate)
        {
            . . .
        }
        . . .


Calling the POST method works, but calling the GET method does not; in the latter case, I get, "405 Method Not Allowed - The requested resource does not support http method 'GET'."

I call them with the same exact URL from Postman:

http://localhost:52194/api/platypus/poisontoe/201509

...the only difference being I select "POST" it works, and when I select "GET" it doesn't.

Why would POST work but not GET? What do I have to change in my GET code to get it to be supported/allowed?
Posted

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

  Print Answers RSS


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