1

Hello friend I having problem to like a facebook post. I am developing application in asp.net C#.

My code

 public static string AppendQueryString(string key, string value)
        {
            return string.Format("{0}={1}&", HttpUtility.UrlEncode(key), HttpUtility.UrlEncode(value));
        }
   public string PostID { get; private set; }     

 var url = "https://graph.facebook.com/me/feed?access_token=" + <MY_AccessToken>;
 var parameters =   (AppendQueryString("privacy", "{\"value\": \"EVERYONE\"}"))+
      AppendQueryString("message", "hi everybody this is test message");
 var webRequest = WebRequest.Create(url);
            webRequest.ContentType = "application/x-www-form-urlencoded";
            webRequest.Method = "POST";
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes(parameters);
            webRequest.ContentLength = bytes.Length;
            System.IO.Stream os = webRequest.GetRequestStream();
            os.Write(bytes, 0, bytes.Length);
            os.Close();

  var webResponse = webRequest.GetResponse();
                StreamReader sr = null;
                try
                {
                    sr = new StreamReader(webResponse.GetResponseStream());
                    this.PostID = sr.ReadToEnd();
                }
                finally
                {
                    if (sr != null) sr.Close();
                }

How to like a post using PostID.?

Abhishek B.
  • 5,112
  • 14
  • 51
  • 90
  • possible duplicate of [How to programmatically "press" a 'Like' button through a Facebook Application?](http://stackoverflow.com/questions/3692527/how-to-programmatically-press-a-like-button-through-a-facebook-application) – Brad Larson Sep 05 '11 at 15:28
  • check this this is not a solution but very clever solution ..this is how a spam site made users to like site http://www.liquidrhymes.com/2010/08/25/smoking-hot-bartender-is-some-smoking-hot-facebook-spam/ see this here it is saying not possible to like programatically.. http://stackoverflow.com/questions/3692527/how-to-programmatically-press-a-like-button-through-a-facebook-application Now we were trying to redirect the user to required fanpage just after user authentication we were not able to do that if u get any solution please share it to me I will do the same we are trying in android as p –  Sep 05 '11 at 06:56

0 Answers0