title: POST string to ASP.NET Web Api application - returns null
body: <p>Im trying to transmit a string from client to ASP.NET MVC4 application.</p>
  
  <p>But I can not receive the string, either it is null or the post method can not be found (404 error)</p>
  
  <p>Client Code to transmit the string (Console Application):</p>
  
  <pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:49032/api/test");
  request.Credentials = new NetworkCredential("user", "pw");
  request.Method = "POST";
  string postData = "Short test...";
  byte[] byteArray = Encoding.UTF8.GetBytes(postData);
  request.ContentType = "application/x-www-form-urlencoded";
  request.ContentLength = byteArray.Length;
  
  Stream dataStream = request.GetRequestStream();
  dataStream.Write(byteArray, 0, byteArray.Length);
  dataStream.Close();
  
  WebResponse response = request.GetResponse();
  Console.WriteLine(((HttpWebResponse)response).StatusDescription);
  dataStream = response.GetResponseStream();
  
  StreamReader reader = new StreamReader(dataStream);
  string responseFromServer = reader.ReadToEnd();
  Console.WriteLine(responseFromServer);
  reader.Close();
  dataStream.Close();
  response.Close();
  Console.ReadLine();
  </code></pre>
  
  <p>ASP.NET Web Api Controller:</p>
  
  <pre><code>public class TestController : ApiController
  {
      [Authorize]
      public String Post(byte[] value)
      {
          return value.Length.ToString();
      }
  }
  </code></pre>
  
  <p>In that case I'm able to call the "Post" method, but "value" is <code>NULL</code>.
  If I change the method signature to (string value) than it will never called.</p>
  
  <p>Even "without" the [Authorize] setting it has the same strange behavior. -> So it has nothing to do with the user authentication.</p>
  
  <p>Any ideas what I'm doing wrong?
  I'm grateful for any help.</p>