Facebook Page Like in ASP.NET

This article briefly shows how to use a Facebook like feature in ASP.Net. This feature provides the ability to like a page and show the total number of users who liked the app.

First of all you need to get a login for Facebook and create a new page and select the type of page and fill in the required details and click the get started button.

img1.jpg

Image 1.

img2.jpg

Image 2.

Upload an image for that page and click the "Next" button.

img3.jpg

Image 3.

Now provide the optional details and click "Save info".

img4.jpg

Image 4.

img5.jpg

Image 5.

img6.jpg

Image 6.

img7.jpg

Image 7.

As you can see the page URL, your page is done here.

You can generate page code after from the developer link and click on "Core Concepts" and click on the like link button and fill in this form and click the "Get Code" button.

img8.jpg

Image 8.

This is the code:

  1. <div id="fb-root">  
  2.     </div>  
  3.     <script>  
  4.     (function (d, s, id) {  
  5.             var js, fjs = d.getElementsByTagName(s)[0];  
  6.             if (d.getElementById(id)) return;  
  7.             js = d.createElement(s); js.id = id;  
  8.             js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";  
  9.             fjs.parentNode.insertBefore(js, fjs);  
  10.         } (document, 'script''facebook-jssdk'));  
  11.     </script>

Put this script and div in the head tag and put the page URL in the data-href.

  1. <div class="fb-like-box" data-href="http://www.facebook.com/MyBMWRAJ?ref=hl"  
  2.         data-width="213" data-show-faces="true" data-stream="false" data-border-color="#d9509c"  
  3.         data-header="true" style="padding-bottom: 10px;" async="false">  
  4. </div> 

Put this div in the form tag.

Now run the application to see the result.

img9.jpg

Image 9.


Similar Articles