如何计算出,如果Facebook的用户登录到Facebook的连接从C#
问题描述:
我试图找出如何是否将当前用户与我的网站上自己的Facebook帐户登录...如何计算出,如果Facebook的用户登录到Facebook的连接从C#
我我已经尝试过四处搜寻并浏览facebook名称空间,但还没有发现任何类似于isUserLoggedIn()
的内容。
我猜我错过了它的地方...任何人都知道的方法,将为此工作?
答
检查会话密钥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;
}
你从哪里得到ApiKey?是那个类中存储的私有变量? – Matt 2009-08-04 07:18:21