[英]Publish Post on facebook wall with any authenticated user using C#
我正在使用ImpactWorks.FBGraph dll使用C#在Facebook墙上发布。
我已经使用xyz@gmail.com ID创建了App,并获取了AppId和密钥
facebook.AppID = "51312xxxxxxxxx";
facebook.Secret = "66e76e49be4e92390fxxxxxxxxx";
当我与创建应用程序的用户(xyz@gmail.com)登录时,其工作正常
但是,当我尝试使用其他Facebook帐户登录时,会出现403(禁止访问)错误。
Get Solution using aspsnippets.facebookapi.dll.
protected void Page_Load(object sender, EventArgs e)
{
FaceBookConnect.API_Key = "<Your API KEY>";
FaceBookConnect.API_Secret = "<Your API SECRET>";
if (!IsPostBack)
{
string code = Request.QueryString["code"];
if (!string.IsNullOrEmpty(code))
{
ViewState["Code"] = code;
pnlPost.Enabled = true;
btnAuthorize.Enabled = false;
}
}
}
protected void Authorize(object sender, EventArgs e)
{
FaceBookConnect.Authorize("publish_actions", Request.Url.AbsoluteUri);
}
protected void Post(object sender, EventArgs e)
{
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("link", "http://www.aspsnippets.com");
data.Add("picture", "http://www.aspsnippets.com/images/Blue/Logo.png");
data.Add("caption", "ASP Snippets");
data.Add("name", "ASP Snippets");
data.Add("message", "I like ASP Snippets");
FaceBookConnect.Post(ViewState["Code"].ToString(), "me/feed", data);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.