I've got my ASP.NET MVC 3 Web Application up and running with the Facebook C# SDK.
Following the instructions here, it seems as though once you put in the AppId / Secret in the web config section instructed, that is the settings pulled back when using FacebookApplication.Current
, e.g:
var oAuthClient = new FacebookOAuthClient(FacebookApplication.Current)
{
RedirectUri = new Uri(RedirectUrl)
};
My Web Application is "white labeled" so it serves two websites, with two seperate Facebook Applications.
Previously when i implemented Facebook Connect, i had a global property called "FacebookApplicationId", which looked at the domain and worked out which app id to use.
Is there a graceful way to do this with the Facebook C# SDK?
I could just do this:
var oAuthClient = new FacebookOAuthClient(FacebookApplication.Current)
{
RedirectUri = new Uri(RedirectUrl),
AppId = ManuallyGetTheRightAppIdBasedOnDomain(),
AppSecret = ManuallyGetTheRightAppSecretBasedOnDomain()
};
But that seems un-DRY as i'll have to keep doing that.
Is there a way i can put some smarts in FacebookApplication.Current
, so that the AppId
and AppSecret
properties are already set?
Open to any and all suggestions.