title: web api routing and http post
body: <p>I'm building an API using WEB API 2.</p>
  
  <p>I have the following API controller:</p>
  
  <pre><code>[RoutePrefix("api/account")]
  public class AccountController : ApiController
  {
      [Route("login")]
      [HttpPost]
      public IHttpActionResult AuthenticateUser(string username, string password)
      {
          if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
          {
              return BadRequest("You must submit username and password");
          }
  
          if (!Membership.ValidateUser(username, password))
          {
              return BadRequest("Incorrect username or password");
          }
  
          FormsAuthentication.SetAuthCookie(username, true);
  
          return Ok();
      }
  }
  </code></pre>
  
  <p>And jquery function:</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function () {
          $("#login-form").submit(function (e) {
              e.preventDefault();
  
              var username = $('#username').val();
              var password = $('#password').val();
  
              $.ajax({
                  type: 'POST',
                  url: '/api/account/Login/',
                  data: { username: username, password: password },
                  success: function() {
                      location.reload();
                  }
              });
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>When I submit the login-form, I get the following error in Google Chrome's console:</p>
  
  <pre><code>POST http://localhost:60898/api/account/Login/ 404 (Not Found)
  </code></pre>
  
  <p>How can I create a route that accepts HTTP POST?</p>
  
  <p>Thanks!</p>