开发者

Multiple Facebook Canvas Applications within same web application - CanvasAuthorizeAttribute

开发者 https://www.devze.com 2023-04-09 10:25 出处:网络
I am having a problem with running multiple Facebook applications under a single Web application. Similar to this problem:

I am having a problem with running multiple Facebook applications under a single Web application.

Similar to this problem: Multiple facebook apps under o开发者_如何学Gone web application

I do like the solution suggested here, however the CanvasAuthorizeAttribute uses the FacebookApplication.Current internally and this is a static instance of the FB application within the Web application.

I can't call the .SetApplication method within the controller as I will have concurrency issues.

It would be nice if the FacebookApplication.Current called the Func that is passed into the .SetApplication instead of just calling inside of the .SetApplication.

That way I could pass a function that does my logic for retrieving the correct FB application.

Am I missing something that is already in the SDK?


You can always have your own logic at http://facebook.stackoverflow.com/questions/4931240/multiple-facebook-apps-under-one-web-application/4936703#4936703

    private IFacebookApplication Current
    {
        get
        {
            var url = HttpContext.Current.Request.Url;
            var app = GetSettingsForUrl(url); 
            // put your custom logic here and return the appropriate IFacebookApplication
            return app;
        }
    }

But you should do this during Application_Start where it is still running on a single thread and not in Controller.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号