Initialize Graph API ASP.NET Control

Initialization of Facebook Graph API is made by calling of particular JavaScript with application id and secret. There are also 2 ways to do it: synchronously and asynchronously. If it is made synchronously, whole page has to wait on initialization to be finished to load all HTML elements bellow. Asynchronous way avoids this, but has some other problems. For example, it is not possible to call stream publish or to request for permissions on page load if initialization is not finished.

InitFVK ASP.NET control makes initialization of Facebook Graph API asynchronously and also sets a flag to provide info to other components that initialization is done. The name of the control is chosen to be independent of current Facebook API. When API and initialization Java Script changes in future, it will be enough to change version of the control, instead of changing implementation on each page where initialization is used. Also, the control uses application id and secret defined in web.config to avoid redundancy. Compiled version and source code version of this ASP.NET control are available in C# and VB.NET programming languages, as part of Facebook ASP.NET (C# and VB.NET) Control library.




Configuration

Configuration of the InitFVK ASP.NET control is done in ASPX page by setting optional properties. If dynamic setting of properties is required, they can be also set in the code behind, for example on Page_Load method. Most of the time default control in used, but there are some cases, for example when language has to be explicitly set, when setting of parameters is required. Following table shows the list of all optional parameters.


Properties:
facebook login button asp.net
Property Name
Type
Description
facebook login button asp.net
Language
String
Language code of all social plugins and XFBML based controls. A list of language codes can be found at Facebook language codes. Default value is 'en_US'.
facebook login button asp.net
CheckLoginStatus
String
Check login status. Default is true.
facebook login button asp.net
UseCookie
String
Use Cookie. Default is true.



Usage Examples:

Following examples show registration and insertion of InitFVK ASP.NET control for initializing of Facebook Graph API in ASPX file. Usage of master pages is preferable option, to make an application easier to maintain. Because of that, examples show master page where the control is used. It is required to insert Resizable iFrame control immediately after <body< tag. To be easier to find, important parts for registration and integration of Facebook control inside ASP.NET page are highlighted.


Integration in ASP.NET master page:
 <%@ Master AutoEventWireup="true" Inherits="FVK_Demo.Master" %>
 <%@ Register TagPrefix="fvk" TagName="initfvk" Src="~/FVK/InitFVK.ascx" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.Facebook.com/2008/fbml"> 
    <head id="Head1" runat="server">
       <title>FVK Demo</title>  
       <link rel="stylesheet" type="text/css" href="/FVK/fvk.css" />
       <asp:ContentPlaceHolder ID="head" runat="server">
       </asp:ContentPlaceHolder>
     </head>
    <body>
       <fvk:initfvk ID="initfvk1" runat="server" />
       <img src="/Images/banner.png" alt="" />
       <br />
       <form id="form1" runat="server">
          <asp:ScriptManager ID="ScriptManager1" runat="server">
          </asp:ScriptManager>
    
          <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        
          </asp:ContentPlaceHolder>
       </form>
    </body>
 </html>

 

Customer Testimonials

"Save time and get your product done faster with this SDK. If you are looking for a solid foundation to build a Facebook Server application, I Highly recommend this SDK and the GiftApp. With extensive code examples and broad Coverage of all things that a typical Facebook app developer needs, you’ll hit the ground running."

Nader Rahimizad, CTO GamesBox Co., Ltd.

Customer Spotlight



Vote for your favorites

Facebook development platform
Contact   |  Refund Policy   |  Privacy Policy   |  EULA