[英]Publish Post on facebook wall with any authenticated user using C#
I am using ImpactWorks.FBGraph dll to Post on facebook wall using C#. 我正在使用ImpactWorks.FBGraph dll使用C#在Facebook墙上发布。
I have created App using my xyz@gmail.com id and get AppId and Secret key 我已经使用xyz@gmail.com ID创建了App,并获取了AppId和密钥
facebook.AppID = "51312xxxxxxxxx";
facebook.Secret = "66e76e49be4e92390fxxxxxxxxx";
Its works fine when i loggin with user (xyz@gmail.com) under which i have created App 当我与创建应用程序的用户(xyz@gmail.com)登录时,其工作正常
But when i try to loggin with different facebook account it gives me 403 (Forbidden) error. 但是,当我尝试使用其他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.