title: Post a value from HttpPost Android to Asp.Net Web Api
body: <p>I need to post some value from my Android app to my Asp.Net Web Api. but I only get null in my Web Api, where do you think my problem is?</p>
  
  <p>I have this code for android :</p>
  
  <p>in MainActivity:</p>
  
  <pre><code>List&lt;NameValuePair&gt; IdsToSend = new ArrayList&lt;NameValuePair&gt;();
  for (Message item : messages) {
      IdsToSend.add(new BasicNameValuePair("messageIds", item.Id));               
  }
  parser.sendPostRequest(UpdateMessageStatuseURL ,IdsToSend);
  </code></pre>
  
  <p>in some other file:</p>
  
  <pre><code>public void sendPostRequest(String url, List&lt;NameValuePair&gt; params) {
  
          try {
              DefaultHttpClient httpClient = new DefaultHttpClient();
              HttpPost httpPost = new HttpPost(url);
              httpPost.setEntity(new UrlEncodedFormEntity(params));
  
              httpClient.execute(httpPost);
  
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
          return;
      }
  </code></pre>
  
  <p>and my Web Api:</p>
  
  <pre><code>public void Post([FromBody]int[] messageIds)
          {
              var dc = new SMSDataDataContext();
              foreach (var item in messageIds)
              {
                  var message = dc.Messages.SingleOrDefault(x =&gt; x.Id == item);
                  if (message != null)
                  {
                      message.Statuse = 1;
                      dc.SubmitChanges();
                  }
              }
  
          }
  </code></pre>