Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7506365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:14:13+00:00 2026-05-29T22:14:13+00:00

I pretend to integrate my website with facebook, whant to make a automatic post

  • 0

I pretend to integrate my website with facebook, whant to make a automatic post (on a specific facebook account) while a user interacts with a web application.

is there any way to make this operation like a webservice way?, authenticating and calling a url that posts the information i send directly on the facebook wall?

i’m using asp.net mvc3 C# i’ve found a facebook developer toolkit library, is this the correct way to start or what should i do?

What is necessary is only write a post automatically on a facebook account, for example when i write a new article (news) on my website, it will be automatically posted on fb.

any idea to get me started?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:14:15+00:00Added an answer on May 29, 2026 at 10:14 pm

    I did something kind of similar, when a user clicks on a “share” button on my mvc app, it posts something on his wall. The problem using the oauth dialog, is that it will redirect the browser to a facebook site for the user to log in and accept the application permissions.

    On the “share” button, I linked it to this url:

                            <a href=""https://www.facebook.com/dialog/oauth?client_id=[YOUR_APP_ID]&redirect_uri=[THE_REDIRECT_PAGE]/&scope=publish_stream"">
                            <img src='@Url.Content("~/Images/facebook_share.png")' alt="Share on Facebook!" style="height:28px" />
                        </a>
    

    YOUR_APP_ID is your facebook application ID.
    THE_REDIRECT_PAGE is a public page on your site that facebook will automatically redirect once the user has logged in and accepted the permissions. When facebook redirects, it appends a querystring parameter called “code” to it.
    NOTE: The redirect page MUST END with a “/”, it cannot end with a document, or else it doesn’t work!

    Once the user has accepted your request, you must ask facebook another code, called access code, used to post on the user’s wall.

    This code is on the redirect page:

            public ActionResult Index(string code)
        {
            string fbAuthCode = Request["code"]; //The authorization code.
            string fbAppId = "XXXXXXX"; //Your fb application id.
            string fbSecretAppId = "XXXXXXXXXXXXXXXXXXXXX"; //Your fb secret app id, it is found on the fb application configuration page.
            string redirectUrl = string.Format("[THE_REDIRECT_PAGE]", locationPointId, entryLocationId); //The redirect url. THIS MUST BE THE EXACT SAME REDIRECT URL USED ON THE JAVASCRIPT LINK!
            string fbUrl = "https://graph.facebook.com/oauth/access_token?client_id=" + fbAppId + "&redirect_uri=" + redirectUrl + "&client_secret=" + fbSecretAppId + "&code=" + fbAuthCode; //Url used to post.
            string accessToken = string.Empty;
    
            try
            {
                WebClient client = new WebClient();
                using (Stream stream = client.OpenRead(fbUrl))
                using (StreamReader reader = new StreamReader(stream))
                {
                    accessToken = reader.ReadToEnd().Split('&')[0].Replace("access_token=", string.Empty);
                    reader.Close();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("An error ocurred while trying to get the fb token in " + fbUrl, ex);
            }
    

    Once you have the access token, you can post to the user wall:

                string postUrl = "https://graph.facebook.com/me/feed";
            string postParameters;
    
            postParameters = string.Format("message={0}&picture={1}&name={2}&caption={2}&description={3}&link={4}&access_token={5}",
                                                "[Message]",
                                                "[PictureUrl]",
                                                "[Name]",
                                                "[Caption]",
                                                "[Link]",
                                                accessToken);
    
            try
            {
                System.Net.WebRequest req = System.Net.WebRequest.Create(postUrl);
    
                req.ContentType = "application/x-www-form-urlencoded";
                req.Method = "POST";
    
                byte[] bytes = System.Text.Encoding.UTF8.GetBytes(postParameters);
                req.ContentLength = bytes.Length;
                using (System.IO.Stream os = req.GetRequestStream())
                {
                    os.Write(bytes, 0, bytes.Length); //Push it out there
                    os.Close();
                    using (WebResponse resp = req.GetResponse())
                    using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
                    {
                        ViewBag.PostResult = sr.ReadToEnd().Trim();
                        sr.Close();
                    }
                    os.Close();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("An error ocurred while posting data to the user's wall: " + postUrl + "?" + postParameters, ex);
            }
    
            return RedirectToAction(XXXXXXXXXXXxx....); //Then i redirect to another page.
    

    You can see that on the exception I throw the posted url (for debugging purposes).
    With that url you can usually go to the facebook Graph API Explorer or the Linter and check the real error.

    I don’t know if this is exactly what you want but hope it gives you a kickoff…
    I’ve struggled a few days with this, because facebook documentation on open graph is not very good yet, at least for us that don’t use curl 🙂

    https://developers.facebook.com/docs/opengraph/tutorial/
    https://developers.facebook.com/docs/opengraph/

    Hope it helps.
    MT.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing a client-server chat application (in fact I'm not, but let's pretend I
Let's pretend my program contains a specific construct the C++ Standard states to be
Using Apple's Mail application as an example; pretend it uses Core Data. When you
I have an ASP.NET application that uses themes. Let's pretend I have a theme
Lets pretend you have a 3 Gb jar file and your application only uses
Let's pretend it's for word frequency counts in a web crawler. Is relational the
Suppose we have two tables. Post and Comment. Post has many Comments. Pretend they
I am using an API (Let's pretend its facebook) to gather data between two
I cannot pretend to begin to understand how AI software is created, but while
I have an application that does a lot of drawing, let's pretend it's a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.