This article demonstrates how to post content (status, image, video, URL) to a user's Facebook wall using ASP.Net. Since I was thinking of implementing this feature in my current project, I found something cool and decided to share it with C# Corner readers.
Getting Started
First of all create a new website in ASP.Net using C#. And now login into Facebook and click on the developer link and create a new app and supply an app name and click "Continue".
Image1.
Now supply the captcha code in the TextBox and click "Continue".
Image 2.
As you can see, there is an AppID and App Secret. You must use these so copy them. And supply the site URL and click "Save changes".
Image 3.
Now let's start working on the UI. In this sample I will explain two ways to post a feed.
First scenario
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
- <div id="fb-root">
- </div>
- <script>
- window.fbAsyncInit = function () {
- FB.init({ appId: '491677990891136', status: true, cookie: true,
- xfbml: true
- });
- };
- (function () {
- var e = document.createElement('script'); e.async = true;
- e.src = document.location.protocol +
- '//connect.facebook.net/en_US/all.js';
- document.getElementById('fb-root').appendChild(e);
- } ());
- </script>
- <script type="text/javascript">
- $(document).ready(function () {
- $('#share_button').click(function (e) {
- e.preventDefault();
- FB.ui(
- {
- method: 'feed',
- name: 'jQuery Dialog',
- link: 'http://www.c-sharpcorner.com/authors/raj1979/raj-kumar.aspx',
- picture: 'http://www.c-sharpcorner.com/UploadFile/AuthorImage/raj1979.gif',
- caption: 'This article demonstrates how to use the jQuery dialog feature in ASP.Net.',
- description: 'First of all make a new website in ASP.Net and add a new stylesheet and add .js files and put images in the images folder and make a reference to the page.',
- message: 'hello raj message'
- });
- });
- });
- </script>
- <div>
- <input type="button" id="share_button" value="Share" />
- </div>




Younes SalehiPosted Apr 13, 2022, 10:34 AM
Hello. Thanks for the very useful article. I could not find Facebook Client in this page. May I ask you to share it with me at [email protected]? Thanks again.
immad uddinPosted Jul 3, 2020, 8:19 AM
Invalid Scopes: publish_stream, manage_pages. This message is only shown to developers. Users of your app will ignore these permissions if present. Please read the documentation for valid permissions at: https://developers.facebook.com/docs/facebook-login/permissions
Dulce Ávila MendozaPosted Jul 22, 2019, 12:14 PM
Any idea to upload your profile and like in your profile picture?
Sweetu PatelPosted Jun 20, 2018, 1:13 AM
Hello, can you please send me the source code on [email protected]
Anu VPosted Jul 12, 2016, 5:09 AM
Nice
Venkatesh PanugantiPosted Jul 5, 2016, 8:00 AM
Nice article <a href="https://www.allinterviewquestions.in/">.net interview questions</a>
Ravi ShahPosted Dec 3, 2015, 9:13 AM
hi.. Nice article how to get Request["code"] in C# time.. it display null in every time..
Upendra Pratap ShahiPosted Aug 21, 2015, 7:13 AM
nice one
Malik AsgharPosted Jul 16, 2014, 5:07 AM
hi raj i want to add my custom text in say something box ,how it possible
Bhavesh DobariyaPosted Apr 29, 2014, 7:56 AM
what is FacebookClient?? from where it comes???
Trung NguyenPosted Sep 19, 2013, 2:45 AM
Please send me the source code to [email protected]
satya dineshPosted Aug 18, 2013, 8:27 AM
Please send me the source code to [email protected]
Raj KumarPosted May 11, 2013, 11:57 AM
u can install facebook assembly from NuGet.
Rajeev RanjanPosted May 10, 2013, 5:11 AM
sir from where i will get the Facebook client assembly ??
Suthish NairPosted Apr 8, 2013, 4:00 AM
Hi abul, everything is given here.. why you just get the samples and try yourself..
abul hasanPosted Apr 4, 2013, 8:35 AM
Hi Dude this good articles can u give demo for this or plz send demo for this to [email protected]
Ashutosh ChaturvediPosted Mar 17, 2013, 12:18 PM
It's really good ...
Yehya ZreikeditedPosted Mar 10, 2013, 5:26 PMEdited Mar 10, 2013, 6:22 PM
Thank you, I Tried the ASP.NET scenario & it is working very well
Raj KumarPosted Mar 8, 2013, 1:11 AM
@Suthish Nair I can give you my password :)
Raj KumarPosted Mar 8, 2013, 1:10 AM
@Yehka and Carla this is the only source code. main thing is configure on facebook. private void CheckAuthorization()
Yehya ZreikPosted Mar 6, 2013, 5:50 PM
would you please provide us with the source code
carlaPosted Mar 6, 2013, 1:39 AM
No source code?
Rajeev KumarPosted Mar 1, 2013, 4:48 AM
gud... sure i will try to implement it.
Suthish NairPosted Mar 1, 2013, 3:56 AM
good one.. password is secret :)
Neha SharmaPosted Mar 1, 2013, 3:19 AM
intresting..