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

    How to post on facebook fan page with asp.net 3.5?

    hi

    i want insert post on my fan page with asp.net 3.5
    and i just have app id and app secret ,and idon't know how to connect to facebook


    i'm using 3.5,i saw they using url for get access token and i don't want redirect my page to another page too
  • #725359
    Hi,

    Follow the below steps

    Step1:
    Create page in the facebook for your website

    Step 2: Place this attached image in the root folder images\facebook.png

    step3 : use the below code in your website (make sure below line you exactly set ur page url)


    <a href="http://www.facebook.com/pages/ypurpageurl" target="_blank">
    <img src="images/facebook.png" alt="facebook" title="facebook" width="32" height="32"
    border="0"></img>
    </a>

    Regards
    N.Ravindran
    Your Hard work never fails

    Delete Attachment

  • #725362
    ok i will try this

  • #725364
    i made test app on facebook
    i am doing it this way

    Dictionary<string, string> data = new Dictionary<string, string>();
    string io = " <a href='http://www.facebook.com/pages/suraj' target='_blank'><img src='Images/Koala.jpg' alt='facebook' title='facebook' width='32' height='32' border='0'></img></a>";

    data.Add("message", io);
    FaceBookConnect.Post(ViewState["Code"].ToString(), "me/feed", data);
    what should come over here ypurpageurl
    in the page link
    <a href="http://www.facebook.com/pages/ypurpageurl" target="_blank">

    how to post html content on facebook from asp.net

  • #725367
    Hi,

    first you create the page for your website in the below url

    https://www.facebook.com/pages/create/

    after created you got the url of your page. Use that url in the below anchor tag

    <a href="http://www.facebook.com/pages/ypurpageurl" target="_blank">
    <img src="images/facebook.png" alt="facebook" title="facebook">
    </img>
    </a>

    Regards
    N.Ravindran
    Your Hard work never fails

  • #725372
    i created a page testmkl the image is not coming instead i am receving the the below text on my facebook wall not on testmkl fanpage


    <a href='http://www.facebook.com/pages/testmkl' target='_blank'><img src='Images/Koala.jpg' alt='facebook' title='facebook' width='32' height='32' border='0'></img></a>

    this is my code

    protected void Page_Load(object sender, EventArgs e)
    {



    FaceBookConnect.API_Key = "key";
    FaceBookConnect.API_Secret = "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)
    {
    string accessToken = GetAccessToken(FaceBookConnect.API_Key, FaceBookConnect.API_Secret);
    FaceBookConnect.Authorize("publish_actions", Request.Url.AbsoluteUri);
    }
    protected void Post(object sender, EventArgs e)
    {
    Dictionary<string, string> data = new Dictionary<string, string>();
    string io = " <a href='https://www.facebook.com/testmkl' target='_blank'><img src='Images/Koala.jpg' alt='facebook' title='facebook' width='32' height='32' border='0'></img></a>";
    data.Add("message", io);
    FaceBookConnect.Post(ViewState["Code"].ToString(), "me/feed", data);
    }

  • #725380
    ?

  • #725434
    You need to used these namespace in c# for importing facebook: using ASPSnippets.FaceBookAPI;using System.Collections.Generic; and Try below code for post on facebook fan page with asp.net

    FacebookClient app = new FacebookClient("[YOUR_ACCESS_TOKEN]");

    exampletry
    {
    var result = app.Post("/" + [PAGE_ID] + "/feed", messagePost);
    }
    catch (FacebookOAuthException ex)
    {
    // write your requirement
    a href='http://www.facebook.com/pages/tean' target='_blank'><img src='Images/facebook.jpg' alt='facebook' title='facebook' width='32' height='32' border='0'></img></a>
    }
    catch (FacebookApiException ex)
    {
    // write your else requirement
    }
    Below links will be helpful for you
    http://www.aspsnippets.com/Articles/Post-Publish-and-Share-content-on-users-FaceBook-Wall-using-Graph-API-in-ASPNet.aspx
    http://stackoverflow.com/questions/5878463/simplest-way-to-post-to-a-facebook-fan-pages-wall-with-c

  • #725438
    FacebookClient i ahve added the dll FacebookClient.dll
    but when i build the solution i am getting this error
    Error 1 Could not load file or assembly 'FacebookClient' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

    i am using dotnet frame work 3.5


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.