title: HttpWebRequest get 404 page only when using POST mode
body: <p>First of all: I know this has been asked over 100 times, but most of these questions were eigher caused by timeout problems, by incorrect Url or by foregetting to close a stream (and belive me, I tried ALL the samples and none of them worked).
  So, now to my question: in my Windows Phone app I'm using the HttpWebRequest to POST some data to a php web service. That service should then save the data in some directories, but to simplify it, at the moment, it only echos "hello".
  But when I use the following code, I always get a 404 complete with an apache 404 html document. Therefor I think I can exclude the possibility of a timeout. It seems like the request reaches the server, but for some reason, a 404 is returned. But what really makes me be surprised is, if I use a get request, everything works fine. So here is my code:</p>
  
  <pre><code>HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.CreateHttp(server + "getfeaturedpicture.php?randomparameter="+ Environment.TickCount);
  webRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0";
  webRequest.Method = "POST";
  webRequest.ContentType = "text/plain; charset=utf-8";
  StreamWriter writer = new StreamWriter(await Task.Factory.FromAsync&lt;Stream&gt;(webRequest.BeginGetRequestStream, webRequest.EndGetRequestStream, null));
  writer.Write(Encoding.UTF8.GetBytes("filter=" + Uri.EscapeDataString(filterML)));
  writer.Close();
  webRequest.BeginGetResponse(new AsyncCallback((res) =&gt;
  {
      string strg = getResponseString(res);
      Stator.mainPage.Dispatcher.BeginInvoke(() =&gt; { MessageBox.Show(strg); });
  }), webRequest);
  </code></pre>
  
  <p>Although I don't think this is the reason, here's the source of getResponseString:</p>
  
  <pre><code>public static string getResponseString(IAsyncResult asyncResult)
  {
      HttpWebRequest webRequest = (HttpWebRequest)asyncResult.AsyncState;
      HttpWebResponse webResponse;
      try
      {
          webResponse = (HttpWebResponse)webRequest.EndGetResponse(asyncResult);
      }
      catch (WebException ex)
      {
          webResponse = ex.Response as HttpWebResponse;
      }
      MemoryStream tempStream = new MemoryStream();
      webResponse.GetResponseStream().CopyTo(tempStream);
      tempStream.Position = 0;
      webResponse.Close();
      return new StreamReader(tempStream).ReadToEnd();
  }
  </code></pre>