title: Post comment to facebook wall using asp.net
body: <p>I have a website that I have registered as a facebook app - I now have an app ID.</p>
  
  <p>My website is ASP.net C#. When the user clicks a button I'd like it to post a pre-defined message to their wall. I'm expecting Facebook to present a login dialog to the user - they login and grant publish permission to for my website app.</p>
  
  <p>Does anyone have any sample code that would do this? I think I need to use the graph API but all the examples I've seen use PHP - which I know nothing about. I'm looking for an example that would use Java Script (of which I know almost nothing) or C# (beautiful!).</p>
  
  <p><strong>* Update *</strong></p>
  
  <p>I have managed to get the access_token. Now I make a call through the Facebook C# API to post to the wall. I get the error message:</p>
  
  <p><strong>(#803) Some of the aliases you requested do not exist: profile_id</strong></p>
  
  <p>I've stepped through the api code and found that it is trying to post to the following address: {<strong>https://graph.facebook.com/PROFILE_ID/feed</strong>}, the post data is: message=Sample+message+from+c%23+sdk&amp;access_token=199209316768200|2.1avFTZuDGR4HJ7jPFeaO3Q__.3600.1302897600.1-100000242760733|R4DkNDf4JCb6B2F64n5TSQwBqvM</p>
  
  <p>I'm pretty sure my token should be valid. Prior to requesting access token I requested publish_stream on the app authorization request as follows:</p>
  
  <pre><code>Response.Redirect ("https://www.facebook.com/dialog/oauth?client_id=" + myAppId + "&amp;redirect_uri=" + myURL + "&amp;scope=publish_stream");
  </code></pre>
  
  <p>The sdk code that actually makes the request is as follows:</p>
  
  <pre><code>private string MakeRequest(Uri url, HttpVerb httpVerb,
                                     Dictionary&lt;string, string&gt; args)
          { 
          if (args != null &amp;&amp; args.Keys.Count &gt; 0 &amp;&amp; httpVerb == HttpVerb.GET)
          {
              url = new Uri(url.ToString() + EncodeDictionary(args, true));
          }
  
          HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
  
          request.Method = httpVerb.ToString();
  
          if (httpVerb == HttpVerb.POST)
          {
              string postData = EncodeDictionary(args, false);
  
              ASCIIEncoding encoding = new ASCIIEncoding();
              byte[] postDataBytes = encoding.GetBytes(postData);
  
              request.ContentType = "application/x-www-form-urlencoded";
              request.ContentLength = postDataBytes.Length;
  
              Stream requestStream = request.GetRequestStream();
              requestStream.Write(postDataBytes, 0, postDataBytes.Length);
              requestStream.Close();
          }
  
          try
          {
              using (HttpWebResponse response 
                      = request.GetResponse() as HttpWebResponse)
              {
                  StreamReader reader 
                      = new StreamReader(response.GetResponseStream());
  
                  return reader.ReadToEnd();
              }
          }
  </code></pre>
  
  <p>Can anyone see what I'm doing wrong?</p>
  
  <p>Many thanks,</p>
  
  <p>Rob.</p>