title: Posting data to asp.net Web API
body: <p>I'm trying to figure out the new ASP.NET Web API.</p>
  
  <p>So far I've been able to create this method signature and connect to it just fine and get a valid response...</p>
  
  <pre><code>[HttpPost]
  public HttpResponseMessage CreateAccount()
  </code></pre>
  
  <p>I am able to send a request to this method with fiddler and have verified that it is receiving the request.</p>
  
  <p>However, when I try to pass data is when I am running into a problem.</p>
  
  <p>The first thing I tried was...</p>
  
  <pre><code>[HttpPost]
  public HttpResponseMessage CreateAccount([FromBody]string email, [FromBody]string password)
  </code></pre>
  
  <p>And I type </p>
  
  <p>email:xyz,password:abc </p>
  
  <p>into the body of the request in fiddler.  When I do this I get a 500 error stating</p>
  
  <p>'Can't bind multiple parameters ('email' and 'password') to the request's content.'</p>
  
  <p>I have also tried this as a method signature...</p>
  
  <pre><code>[HttpPost]
  public HttpResponseMessage CreateAccount([FromBody]UserAccountRequestData data)
  </code></pre>
  
  <p>with the UserAccountRequestData being a simple POCO</p>
  
  <pre><code>public class UserAccountRequestData
  {
      public string Email { get; set; }
      public string Password { get; set; }
  }
  </code></pre>
  
  <p>And I put</p>
  
  <p>{Email:xyz,Password:abc}</p>
  
  <p>or</p>
  
  <p>data:{Email:xyz,Password:abc}</p>
  
  <p>into the body of the request.  In both cases trying to populate the POCO I am able to reach the method while debugging, but the data object is always null.</p>
  
  <p>I need to understand how to create API methods that accept both strongly typed POCOs and others that accept multiple primitive types like strings and ints.</p>
  
  <p>Thanks</p>