我想使用 ASP.NET 在我的粉丝页面上发布 FB 帖子。我可以在我的粉丝页面上发帖,但作为管理员,我可以看到所有帖子。但是喜欢该页面的人无法看到帖子。如果我在页面上手动发布任何内容,那么该特定帖子将被其他人看到。请帮忙。我正在使用以下代码
string app_id = "214545998669814";
string app_secret = "8cd4e507b943bb34bfb0c33830cbe2a9";
string scope = "publish_stream,manage_pages,offline_access,publish_actions";
if (Request["code"] == null)
{
Response.Redirect(string.Format(
"https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&scope={2}",
app_id, Request.Url.AbsoluteUri, scope));
}
else
{
Dictionary<string, string> tokens = new Dictionary<string, string>();
string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}",
app_id, Request.Url.AbsoluteUri, scope, Request["code"].ToString(), app_secret);
HttpWebRequest request = System.Net.WebRequest.Create(url) as HttpWebRequest;
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string vals = reader.ReadToEnd();
foreach (string token in vals.Split('&'))
{
//meh.aspx?token1=steve&token2=jake&...
tokens.Add(token.Substring(0, token.IndexOf("=")),
token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
}
}
string access_token = tokens["access_token"];
var client = new FacebookClient(access_token);
dynamic parameters = new ExpandoObject();
parameters.message = "this is from fan page4.";
parameters.link = string.Empty;
parameters.picture = string.Empty;
parameters.name = "Article Title";
parameters.caption = "Caption for the link";
//446533181408238 is my fan page
client.Post("/548306908572853/feed", parameters);