title: How to send POST request with parameters asynchronously in windows phone 8
body: <p>I would like to send POST request in windows phone 8 environment my code is running successfully but i am getting NotFound exception. Its mean is i want to POST some data but i am sending null. So please let me know how to send POST Request asynchronously with Data in windows phone 8 environmet. I tried following links but not helpful.
  <a href="https://stackoverflow.com/questions/18816990/webrequest-has-no-getresponse-method-windows-phone-8">link</a> <a href="https://stackoverflow.com/questions/16693425/windows-phone-8-post-json-in-request-body-give-an-exception">link2</a></p>
  
  <p>I approached like this</p>
  
  <pre><code>private async Task&lt;LastRead&gt; SyncLastReadPOST(LastRead lastreads, bool actionStatus)
  {
      string jsondata = "";
      actionStatus = false;
      apiData = new LastReadAPI()//It is global variable from apiData this object has the information
      {
          AccessToken = thisApp.currentUser.AccessToken,
          Book = lastreads.Book,
          Page = lastreads.Page,
          Device = lastreads.Device
      };
      jsondata = Newtonsoft.Json.JsonConvert.SerializeObject(apiData);
      LastRead responsedData = new LastRead();
      Uri lastread_url = new Uri(string.Format("{0}lastread", url_rootPath));
      try
      {
          HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(lastread_url);
          webRequest.ContentType = "application/json";
          webRequest.Accept = "application/json;odata=verbose";
          webRequest.Method = "POST";
          webRequest.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), webRequest);
      }
      catch { }
      return responsedData;
  }
  
  private void GetRequestStreamCallback(IAsyncResult ar)
  {
      HttpWebRequest request = (HttpWebRequest)ar.AsyncState;
      Stream postStream = request.EndGetRequestStream(ar);
      var input = Newtonsoft.Json.JsonConvert.SerializeObject(jsondata);//jsondata is my global data variable in json format.
      byte[] byteArray = Encoding.UTF8.GetBytes(input);
      postStream.WriteAsync(byteArray, 0, byteArray.Length);
      postStream.Close();
      request.BeginGetResponse(new AsyncCallback(GetResponseStreamCallback), request);
  }
  
  private void GetResponseStreamCallback(IAsyncResult ar)
  {
      try
      {
          HttpWebRequest webRequest = (HttpWebRequest)ar.AsyncState;
          HttpWebResponse response;
          //In following line i am getting the exception notFound.
          response = (HttpWebResponse)webRequest.EndGetResponse(ar);
          Stream streamResponse = response.GetResponseStream();
          StreamReader streamReaders = new StreamReader(streamResponse);
          var responces = streamReaders.ReadToEnd();
          streamResponse.Close();
          streamReaders.Close();
          response.Close();
      }
      catch(Exception ex)
      {
      }
  }
  </code></pre>
  
  <p>As far as i know notFound exceptions comes when we are not posting any data while using the POST request method. you can see i have mentioned the data i am passing into the GEtRequestStreamCallback. I have mentioned a note. Please help me. Where i am going to wrong.</p>