Multiple facebook apps under one web application

前端 未结 2 1379
离开以前
离开以前 2021-01-06 04:20

I\'m trying to use the umbraco cms for a few facebook apps. My idea was to have each facebook app in an aspx page in umbraco (these \"apps\" are very simple, only a few imag

相关标签:
2条回答
  • 2021-01-06 04:32

    See section 4 of this post on Prabir's blog for details on how to set Facebook settings in code.

    Edit: You will also want to be very careful when managing instances of FacebookClient to avoid confusion ie statics etc.

    0 讨论(0)
  • 2021-01-06 04:44

    You will need to first create a new class implementing IFacebookApplication.

    private class RequestScopedFacebookApplication : IFacebookApplication
    {
            private IFacebookApplication Current
            {
                get
                {
                    var url = HttpContext.Current.Request.Url;
                    var app = GetSettingsForUrl(url);
                    return app;
                }
            }
    
            public string AppId
            {
                get { return Current.AppId; }
            }
            /* ....... */
    }
    

    Then in the Application_Start of global.asax, set your facebook application.

    public void Application_Start()
    {
         FacebookApplication.SetApplication(new RequestScopedFacebookApplication());
    }
    

    UPDATE: Here is an additional sample implementation: https://gist.github.com/820881

    0 讨论(0)
提交回复
热议问题