title: Web API POST method returns HTTP/1.1 500 Internal Server Error
body: <p>As the title says i have got a 500 internal server error when using post method of a Web API. The Get method is working fine, just getting error in POST.</p>
  
  <p>I am using fidler to send post request : </p>
  
  <p><strong>Response Header:</strong>
  HTTP/1.1 500 Internal Server Error</p>
  
  <p><strong>Request Header:</strong>
  User-Agent: Fiddler
  Host: localhost:45379
  Content-Type: application/jsonContent-Length: 41
  Content-Length: 41</p>
  
  <p><strong>Request Body:</strong>
  {"iduser"="123456789","username"="orange"}</p>
  
  <p><strong>Here is my code for post method:</strong></p>
  
  <pre><code>     // POST api/User
       public HttpResponseMessage Postuser(user user)
       {
          if (ModelState.IsValid)
          {
              db.users.Add(user);
              db.SaveChanges();
  
              HttpResponseMessage response =R  equest.CreateResponse(HttpStatusCode.Created, user);
              response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = user.iduser }));
              return response;
         }
         else
          {
              return Request.CreateResponse(HttpStatusCode.BadRequest);
          }
      }
  </code></pre>
  
  <p><strong>Sooooooo what could have possibly gone wrong? Why its not allowing me to POST?</strong></p>