Facebook与Asp .Net集成

| 我需要将面书与asp .net应用程序集成。这是我遵循的步骤。 我已经从脸书创建了脸书应用程序,并获得了应用程序密钥和秘密密钥。 我在应用程序中使用了该应用程序密钥和秘密密钥。 这是我的代码: 但是在这段代码中,\“ Session [\” facebook_userId \“] \”总是给我空值。你能告诉我原因吗? 受保护的void Page_Load(对象发送者,EventArgs e)     {
    _fbService.ApplicationKey = FACEBOOK_APPKEY;
    _fbService.Secret = FACEBOOK_SECRET;
    _fbService.IsDesktopApplication = false;

    string sessionKey = Session[\"facebook_session_key\"] as String;        
    userId = Session[\"facebook_userId\"] as String;

    // When the user uses the facebook login page, 
    // the redirect back here will have the auth_token in the query params
    string authToken = Request.QueryString[\"auth_token\"];

    if (!String.IsNullOrEmpty(sessionKey))
    {
        _fbService.SessionKey = sessionKey;
        _fbService.UserId = userId;
    }
    else if (!String.IsNullOrEmpty(authToken))
    {
        _fbService.CreateSession(authToken);
        Session[\"facebook_session_key\"] = _fbService.SessionKey;
        Session[\"facebook_userId\"] = _fbService.UserId;
        Session[\"facebook_session_expires\"] = _fbService.SessionExpires;
    }
    else
    {
        Response.Redirect(@\"http://www.facebook.com/login.php?api_key=\" +
            _fbService.ApplicationKey + @\"&v=1.0\");
    }
    if (!IsPostBack)
    {
        System.Collections.ObjectModel.Collection<User> userinfo = _fbService.GetUserInfo(_fbService.UserId);
        Label1.Text = userinfo[0].FirstName + \"\'s favorite shops\";
        Image1.ImageUrl = userinfo[0].PictureUrl.ToString();

        // Use the FacebookService Component to populate Friends
        System.Collections.ObjectModel.Collection<User> Friends = _fbService.GetFriends();
        for (int i = 0; i < Friends.Count; i++)
            DropDownList2.Items.Add(Friends[i].FirstName.ToString());
    }
}
} 为此请帮我!     
已邀请:
        您正在使用哪个工具箱? 我建议您使用Codeplex中的facebooksdk。是的,正如Rufinus所说,您对Facebook的每个请求都需要access_token。我无法在您的代码中的任何地方看到它 改用此链接。。C#中的Facebook Graph API     

要回复问题请先登录注册