Skip to content

Instantly share code, notes, and snippets.

View ntotten's full-sized avatar

Nathan Totten ntotten

View GitHub Profile
CanvasUrlBuilder urlBuilder = new CanvasUrlBuilder(httpContext.Request, canvasSettings);
var url = urlBuilder.GetLoginUrl(this.FacebookApp, Perms, ReturnUrlPath, CancelUrlPath);
public void Application_Start()
{
FacebookContext.SetApplication(new RequestScopedFacebookApplication());
}
private class RequestScopedFacebookApplication : IFacebookApplication
{
private IFacebookApplication Current
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=9; chrome=1" />
</customHeaders>
</httpProtocol>
</system.webServer>
@ntotten
ntotten / Global.asax.cs
Created February 10, 2011 16:59
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());
}
}
namespace System.Web.Mvc {
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Text;
using System.Web;
using System.Web.WebPages.Html;
using Microsoft.Internal.Web.Utils;
namespace System.Web.Mvc {
using System.Runtime.CompilerServices;
[TypeForwardedFrom("System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
public enum TagRenderMode {
Normal,
StartTag,
EndTag,
SelfClosing
}
[Export]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class AccountController : Controller
{
const string appId = "188070564565375";
const string appSecret = "<app_secret>";
// **************************************
// URL: /Account/LogOn
public class CachedLocationService : LocationService
{
private static List<StoreLocation> locations;
private static DateTime expireTime = DateTime.UtcNow;
private static object syncLock = new object();
public CachedLocationService(DataModelContainer dataModelContainer)
: base(dataModelContainer) { }
public override StoreLocation GetByStoreNumber(int storeNumber)
dynamic data = CanvasContext.Current.SignedRequest.Data
if (data.page.liked) {
// has liked
} else {
// Not liked
}
@ntotten
ntotten / FacebookLogger.cs
Created March 18, 2011 19:05
Facebook C# SDK Logging Mockup
public class FacebookLogger {
private static readonly FacebookLogger Instance = new FacebookLogger();
/// <summary>
/// Gets the current Facebook logger.
/// </summary>
public static IFacebookLogger Current
{
get