views:

315

answers:

1

I'm trying to figure how whether or not the current user is logged in with their facebook account on my site...

I've tried searching around and looking through the facebook namespace but haven't found anything similar to isUserLoggedIn().

I'm guessing I missed it somewhere... Anyone know of a method that would work for this?

A: 

Check for the session key cookie.

    public static string SessionKey
    {
        get { return GetFacebookCookie("session_key"); }
    }

    private static string GetFacebookCookie(string propertyName)
    {
        var fullName = ApiKey + "_" + propertyName;

        if (HttpContext.Current == null || HttpContext.Current.Request.Cookies[fullName] == null)
            return null;

        return HttpContext.Current.Request != null ? HttpContext.Current.Request.Cookies[fullName].Value : null;
    }
CD
Where are you getting ApiKey from? is that a private variable stored in that class?
Matt
That's the key you get from fb for your app.
CD