title: System.Net.WebException The remote server returned an error: NotFound with POST JSON request in Windows Phone 7
body: <p>this might be a simple one.</p>
  
  <p>I'm trying to make a simple POST request to something a friend of mine made, and a REST tester confirms that it is indeed working. This is my code:</p>
  
  <pre><code>private void sendJsonRequest()
      {
          var httpWebRequest = (HttpWebRequest) WebRequest.Create("http://boom.antomontani.com/api/v1/users.json");
          httpWebRequest.ContentType = "text/json";
          httpWebRequest.Method = "POST";
  
          httpWebRequest.BeginGetRequestStream(GetRequestStreamCallback, httpWebRequest);
      }
  
      private static void GetRequestStreamCallback(IAsyncResult asyncResult)
      {
          HttpWebRequest request = (HttpWebRequest) asyncResult.AsyncState;
  
          Stream postStream = request.EndGetRequestStream(asyncResult);
  
          string json = "{ \"phone\": \"" + phone + "\" }";
          byte[] byteArray = Encoding.UTF8.GetBytes(json);
  
          postStream.Write(byteArray, 0, json.Length);
          postStream.Close();
  
          request.BeginGetResponse(GetResponseCallback, request);
      }
  
      private static void GetResponseCallback(IAsyncResult asyncResult)
      {
          HttpWebRequest request = (HttpWebRequest) asyncResult.AsyncState;
  
          HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(asyncResult);
  
          Stream streamResponse = response.GetResponseStream();
          StreamReader reader = new StreamReader(streamResponse);
  
          string responseString = reader.ReadToEnd();
  
          streamResponse.Close();
          reader.Close();
  
          response.Close();
  
          result = responseString;
      }
  </code></pre>
  
  <p>When debugging, the execution break at the EndGetResponse, with the exception</p>
  
  <pre><code>[System.Net.WebException]   {"The remote server returned an error: NotFound."}  System.Net.WebException
       at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)\r\n   at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)\r\n   at JSONBoom.PhoneNumber.GetResponseCallback(IAsyncResult asyncResult)\r\n   at System.Net.Browser.ClientHttpWebRequest.&lt;&gt;c__DisplayClassa.&lt;InvokeGetResponseCallback&gt;b__8(Object state2)\r\n   at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadPool.WorkItem.doWork(Object o)\r\n   at System.Threading.Timer.ring()\r\n"
  </code></pre>
  
  <p>As far as I'm concerned, my WMAppManifest has ID_CAP_NETWORKING, which I read could be a possible cause for problems. Other than that, I'm out of ideas...</p>