- Go to https://developers.facebook.com/apps then click on create a new app.
- A pop up box will appear, fill in the information and click continue.
Make sure you enable the Sandbox Mode
- Now open your visual studio 2012, create a new project then select Visual C#>Web>ASP.Net MVC 4 Web Application. Give a name for your application and click OK.
- Choose Facebook Application project template, if you don’t see the template you must download ASP.net and Web Tools 2012.12 release.
- In the Solution Explorer click on Web.config, then you will be able to see AppID, AppSecret and App Namespace, fill them up.
Go back to facebook and get your AppID, AppSecret and App Namespace.
- Now in the Solution Explorer, right click on FBApplication, click Properties, then go to the Web tab. Copy the Project Url.
- Go back to Facebook, check the “App on Facebook” mark, then paste the copied link in the Canvas URL. Scroll down then click on the Save Changes.
- Now in Visual Studio, Build and run the app. You will find the Facebook Authentication dialog popping up. Click Go To App, then you will see another dialog popping up click on allow.
Tadaa! Your app is now running inside Facebook, retrieving your Friends and Photos.
Moving from local to Azure. So that your friend are allow to use the application too.
Now what we’ve done is just locally, no one will be able to use your app yet. So let’s host our application on Azure Website.
If you haven’t created an account on Azure yet, go ahead and create now. It is free.
- Now login and click on Management Portal then click on New.
- Create a new website and fill in a appropriate URL name. Then click on Create Web Site.
after is done, click on ‘myfbappmvc’.
- Now download publishing profile and save it on your computer.
- Go back to Visual Studio, right click on the FBApplication, click Publish, click Import, then browse to the file you saved earlier.
after importing the settings, click on publish.
- Finally, now you notice that your application is publish to http://myfbappmvc.azurewebsites.net/.Go back to facebook change the Canvas URL and make sure Sandbox Mode is Disabled.