Thursday, April 12, 2012

facebook api post to wall not working at server 400 bad request

I am trying to post request on the wall but facing a 400 Bad Request error.



I am using the following code:-



if (string.IsNullOrWhiteSpace(user.Facebook) || string.IsNullOrWhiteSpace(user.FacebookToken))
{
req.Status = (int)Notify.NotifyStatus.MissingAccount;
db.SaveChanges();
return false;
}

var address = "https://graph.facebook.com/" + user.Facebook + "/feed";
var form = new System.Collections.Specialized.NameValueCollection();
form.Add("access_token", user.FacebookToken);
form.Add("message", "Connect6");
form.Add("link", joburl);
form.Add("description", description);
form.Add("picture", picture);



WebClient wc = new WebClient();
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
var responseBytes = wc.UploadValues(address, "POST", form);
var page = Encoding.UTF8.GetString(responseBytes);

req.Status = (int)Notify.NotifyStatus.Sent;
db.SaveChanges();
return true;


At response bytes it is giving me error



Please suggest





No comments:

Post a Comment