Aman
Aman

Reputation: 295

Creating Facebook Application in asp.net

I want to create a Facebook IFRAME applicaton with asp.net. I just want to know should I need to host the application some where over internet? If yes, how could I test my application on localhost?

Update:

I just want a simple app for displaying a user name with "Hello." Can anyone show me the code for that with the complete web.config configuration?

I'm trying this code

using facebook.web; namespace TestFbApplication { public partial class _Default:facebook.web.CanvasFBMLBasePage {

 facebook.Components.FacebookService _fbService = new facebook.Components.FacebookService();
 private const string FACEBOOK_APPKEY = "66a8278bb94d969247a80815bab686e5";  // From the Facebook application page
 private const string FACEBOOK_SECRET = "de76280e4ddaef72ac2166afe7ffb9d5";  // From the Facebook application page
    protected void Page_PreInit(object sender, EventArgs e)
    {
        base.RequireLogin = false;

        _fbService.IsDesktopApplication = false;

        _fbService.ApplicationKey = FACEBOOK_APPKEY;
        _fbService.Secret = FACEBOOK_SECRET;

        _fbService.IsDesktopApplication = false;
        _fbService.ConnectToFacebook();

        abc.InnerText = _fbService.users.getInfo().ToString();

    }

and it is throwing and Exception in the last line that that the object reference is not set.

Upvotes: 0

Views: 2574

Answers (2)

Neil Knight
Neil Knight

Reputation: 48597

You will need to host your production application somewhere, but you can test locally. If you set your Canvas URL to http://localhost:81 in Facebook, this should work. It did for me a couple of months ago, but they may have changed it since then.

Upvotes: 1

code master
code master

Reputation: 2026

this might be an interesting for you: http://www.stevetrefethen.com/blog/DevelopingFacebookapplicationsinCwithASPNET.aspx

Upvotes: 0

Related Questions