Facebook ASP.NET MVC Template provides boilerplate code to connect your application to Facebook and retrieve Facebook properties such as Likes, photos, email and friends profile details. However, in order to get your application connect and interact with Facebook, we need to configure some settings from an application that you created in Facebook copy to your ASP.NET MVC project.
- In your browser, navigate to https://developers.facebook.com/apps and log in by entering your Facebook credentials.
- If you aren’t already registered as a Facebook developer, click Register as a Developer and follow the directions to register.
- Click Create New App.(Figure 1)
- Enter an App Name and App Namespace, and then click Continue.(Figure 2)
- On the Basic Settings page for the app, set the Sandbox Mode to Enabled. This ensures that you have exclusive access to the app until it's ready to be made available to everyone.(Figure 3)
- In Visual Studio, open the application Web.config file that is located in the root folder of your project.
- Copy and paste the AppId, App Secret, and App Namespace values into the corresponding key elements in the appSettings collection in the Web.config file.(Figure 4)
- In Solution Explorer, right-click the project and click Properties, and then click the Web tab.
- Copy the Project URL from the Web tab and paste it into the Canvas URL field in the Facebook Basic Settings page.(Figure 5)
- Change Canvas Width to Fluid.
- Click Save Changes.(Figure 6)
- Press CTRL+F5 to run the application.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6