You must Sign In to post a response.
  • Category: ASP.NET

    Posting a images on facebook

    Hi I am using bellow code for posting a images on facebook account

    This code is working fine/ posting images when i am using same facebook account that are using for creating a App. But when i am using another facebook account for posting this is not posting image on facebook wall.

    Below is my test page links where i am using this code.
    http://kietrontesting.canadadevelopershub.com/default.aspx

    using ASPSnippets.FaceBookAPI;
    using System;
    using System.Collections.Generic;

    protected void Page_Load(object sender, EventArgs e)
    {
    FaceBookConnect.API_Key = "632081280310444";
    FaceBookConnect.API_Secret = "76e7b9a124c87793d838129830a6ff29";
    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);
    Response.Redirect("http://www.facebook.com/me/feed");
    }


    Design
    ======

    <asp:Button ID="btnAuthorize" runat="server" Text="Authorize" OnClick="Authorize" /><hr />
    <asp:Panel ID="pnlPost" runat="server" Enabled="false">
    Message: <asp:TextBox ID="txtMessage" runat="server" TextMode="MultiLine"></asp:TextBox><br />
    <asp:Button ID="btnPost" runat="server" Text="Post to Wall" OnClick="Post" />
    </asp:Panel>
  • #768088
    what error you got ? please post it so that we can help you more in order to resolve the your issue. if you have proper API Key and API Secret of FaceBookConnect class then I think you should not have face this issue.
    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #768093
    no not getting any error.

    But not posted on another facebook accounts.

    Please check below link
    http://kietrontesting.canadadevelopershub.com/default.aspx

  • #768101
    I don't think their is possibility for that until their should be something wrong with the API_Key or API_Secret.
    Have you tried with the different login id instead of trying same?
    If you try with some other Login Id and if that still post in different id then we can conclude their will some serious issue with the code. (Hope their wont be any issue with FB)

    Thanks,
    Mani


Sign In to post your comments