protected override void Render(HtmlTextWriter writer)
        {
            if (SPContext.Current != null && SPContext.Current.Web != null && SPContext.Current.Web.CurrentUser != null)
            {
                if (Settings != null)
                {
                    if (Settings.facebook_allow)
                    {
                        FacebookOAuthClient client = new FacebookOAuthClient
                        {
                            AppId     = AppId,
                            AppSecret = AppSecret,
                            ReturnUri = this.Page.Request.Url.AbsoluteUri
                        };

                        try
                        {
                            // Initialize the Facebook service (no calls are made here)
                            FacebookService service = FacebookService.CreateFromAccessToken(Settings.facebook_access_token);

                            // Make a call to the Facebook API to get information about the user
                            FacebookMeResponse user = service.Methods.Me();

                            if (user != null)
                            {
                                System.Web.UI.WebControls.Literal literal = new Literal();

                                literal.Text += "<pre><b>Id</b> " + user.Id + "</pre>";
                                literal.Text += "<pre><b>UserName</b> " + user.UserName + "</pre>";
                                literal.Text += "<pre><b>Name</b> " + user.Name + "</pre>";
                                literal.Text += "<pre><b>Url</b> " + user.Link + "</pre>";
                                literal.Text += "<pre><b>Description</b> " + user.Locale + "</pre>\n";

                                pnl_facebook.Controls.Add(literal);
                            }
                        }
                        catch (Exception)
                        {
                            throw;
                        }
                    }
                }
            }

            base.Render(writer);
        }
 /// <summary>
 /// Gets information about the current user by calling the <var>/me</var> method. This call requires a user access token.
 /// </summary>
 public FacebookMeResponse Me()
 {
     return(FacebookMeResponse.ParseJson(Raw.GetObject("me")));
 }