title: Bad request on facebook page wall post (getResponse())
body: <p>I get an error code 400 "Bad request" when I try to post to a page wall. Here's the code:</p>
  
  <pre><code>public string Post(Int64 Id)
  {
  
      using (DataContext db = new DataContext())
      {
          var msg = (from t1 in db.Table1
                     join t2 in db.Table2 on t1.UserId equals t2.UserId
                     where t1.Id == Id
                     select new {t1, t2}).FirstOrDefault();
  
          var url = "https://graph.facebook.com/" + msg.t2.Table3.FBPageId + "/feed";
          AppendQueryString(ref url, "access_token", msg.t2.Table3.FacebookAuth);
          AppendQueryString(ref url, "privacy", "{\"value\": \"EVERYONE\"}");
          AppendQueryString(ref url, "message", msg.t1.Message);
          var webRequest = WebRequest.Create(url);
          webRequest.ContentType = "application/x-www-form-urlencoded";
          webRequest.Method = "POST";
          byte[] bytes = System.Text.Encoding.ASCII.GetBytes(url);
          webRequest.ContentLength = bytes.Length;
          System.IO.Stream os = webRequest.GetRequestStream();
          os.Write(bytes, 0, bytes.Length);
          os.Close();
  
          try
          {
              var webResponse = webRequest.GetResponse();
          }
          catch (Exception ex)
          {
              return ex.Stacktrace;
          }
  
      return "Something random";             
  }  
  </code></pre>
  
  <p>The code ends at the return in catch (<code>webRequest.GetResponse();</code> failed). </p>
  
  <p><code>AppendQueryString</code> is just a method that generates the query string (? or &amp;) and returns the new <code>url</code>.</p>
  
  <p>Am I doing anything wrong? </p>