Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Multi-Tenant Facebook Application
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
// Register your multi-tenant application on app startup
FacebookApplication.SetApplication(new MultiTenantFacebookApplication());
}
}
public class MultiTenantFacebookApplication : IFacebookApplication
{
private IFacebookApplication GetCurrent()
{
var url = HttpContext.Current.Request.Url;
// Get the settings based on the url or whatever
var simpleApp = new DefaultFacebookApplication();
// Set the settings
return simpleApp;
}
public string AppId
{
get { return GetCurrent().AppId; }
}
public string AppSecret
{
get { return GetCurrent().AppSecret; }
}
public string CancelUrlPath
{
get { return GetCurrent().CancelUrlPath; }
}
public string CanvasPage
{
get { return GetCurrent().CanvasPage; }
}
public string CanvasUrl
{
get { return GetCurrent().CanvasUrl; }
}
public string SiteUrl
{
get { return GetCurrent().SiteUrl; }
}
}
@paulsh
paulsh commented Jul 20, 2011

I want to host 2 facebook apps under one web app (each facebook app is a simple web page with almost the same logic so I'd like to have a web page per facebook app instead of having 2 separate web apps). Is it possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.