title: HTTPPost MVC 4 web api
body: <p>I am building a mvc 4 web api but when ever I try to do a post to the web api the request returns </p>
  
  <pre><code>"The requested resource does not support http method 'POST'."
  </code></pre>
  
  <p>My Request Headers</p>
  
  <pre><code>User-Agent: Fiddler
  Host: localhost:53393
  Content-Length: 39
  Content-Type: application/json
  </code></pre>
  
  <p>My Request Body</p>
  
  <pre><code>{
    "username":"",
    "password":""
  }
  </code></pre>
  
  <p>Routes </p>
  
  <pre><code>    public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "api/{controller}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
  
          routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
          );
      }
  </code></pre>
  
  <p>And the method in my controller</p>
  
  <pre><code>[HttpPost]
  public MethodResponse Authenticate(string username, string password)
  {
      ConsoleServiceClient service = new ConsoleServiceClient();
      return service.Authenticate(username, password);
  }
  </code></pre>
  
  <p>The URL I use</p>
  
  <pre><code>http://localhost:53393/api/service/authenticate
  </code></pre>
  
  <p>I am still new to this, but can't figure out why POST is not supported?</p>
  
  <p>Thanks</p>