Najam Sikander Awan

covering web stack along with microsoft technologies

Facebook Application Development Using

| Comments


I have been busy with facebook application development using IFrame and since I have background so instead of php I wanted to do this in their are few wrappers or sdk available for this like. After googling I have picked Facebook developer toolkit v3.01. After downloading the binaries I have created a web application project with 4.0 framework and simply added the reference of facebook.dll and facebook.web.dll.

In default.aspx code behind file we add the using statements for facebook dlls and inherit our page from facebook.web.CanvasIFrameBasePage and override the PreInit method for default page. Look at the snapshot of my default.aspx.cs for more understanding.

Default page code behind

The hardest part was to configure my app with facebook and I also wanted to continue development using my development PC so that I don’t have to upload my code as code changes. So lets first dive into facebook app configurations.

FB APP Settings

From above snapshot you can see my application will run at at and the domain I am providing as Canvas URL is The domain is not registered to anyone :) I will map this domain to my local IP address ( by editting hosts file.

domain mapping

Note in hosts file you can’t put port with ip address for example 127.0.0./:1259 will not work so in your hosts file you will only enter the mapping between your virtual domain and after making the entry make sure you reboot your PC to commit your changes.

Final part is to edit your web.config file and put app settings section which will contain your faceboko app api key, facebook app secret key and facebook app callbak URL in my case that was for more understanding please look at following snapshot.

web config

Now if you press F5 to run your application it will open facebook page showing your app and you will see your your name.

app result

After creating my first Facebook IFrame application I still want to use xFBML if supported need to test this application in my office. After doing some more experiments will update this post.