private static void Init(String key, FacebookHttpContext fbContext) { if (HttpContext.Current.Application[key] == null) { var appInfoResult = fbContext.Application.GetPublicInfoByApiKey(fbContext.ApiKey); if (appInfoResult.IsError) throw appInfoResult.ResponseException; else HttpContext.Current.Application[key ?? FacebookWebApplication.GetAppStateKey(fbContext.ApiKey)] = new FacebookWebApplication(appInfoResult.Value); } }
private static void InitContext(string name) { if (FacebookHttpSession.Current["__FBCONTEXT"] == null) { FacebookHttpContext context = null; try { context = new FacebookHttpContext(FacebookCommon.Common(name).ApiKey, FacebookCommon.Common(name).Secret); FacebookHttpSession.Current["__FBCONTEXT"] = context; } catch (Exception ex) { throw new ApplicationException("An attempt to initialize FacebookHttpContext with the supplied api key, but no application configurations were found.", ex); } if (HttpContext.Current.Items["__FACEBOOK_HTTP_MODULE"] != null) { ((FacebookHttpModule)HttpContext.Current.Items["__FACEBOOK_HTTP_MODULE"]).OnFacebookContextInit(new FacebookWebEventArgs(FacebookHttpRequest.Current, FacebookHttpSession.Current, context)); } } }
internal static FacebookWebApplication Get(FacebookHttpContext fbContext) { var key = GetAppStateKey(fbContext.ApiKey); return (FacebookWebApplication)HttpContext.Current.Application[key]; }
internal static void Init(FacebookHttpContext fbContext) { FacebookWebApplication.Init(null, fbContext); }
/// <summary>Initializes an instance of the <see cref="FacebookWebEventArgs" /> class with the specified <paramref name="request" />, /// <paramref name="session" /> and <paramref name="context" /> objects.</summary> /// <param name="request">A reference to the current <see cref="FacebookHttpRequest" /> object at the time of the event.</param> /// <param name="session">A reference to the current <see cref="FacebookHttpSession" /> object at the time of the event.</param> /// <param name="context">A reference to the current <see cref="FacebookHttpContext" /> object at the time of the event.</param> public FacebookWebEventArgs(FacebookHttpRequest request, FacebookHttpSession session, FacebookHttpContext context) { this.Request = request; this.Session = session; this.Context = context; }