Skip to content

Instantly share code, notes, and snippets.

@ntotten
Created February 10, 2011 16:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ntotten/820881 to your computer and use it in GitHub Desktop.
Save ntotten/820881 to your computer and use it in GitHub Desktop.
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
Copy link

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