protected void Page_Load(object sender, EventArgs e)
        {
            string       url   = "";
            AuthFacebook oAuth = new AuthFacebook();

            if (Request["code"] == null)
            {
                Response.Redirect(oAuth.GetAuthorizationLink());
            }
            else
            {
                oAuth.GetAccessToken(Request["code"]);

                if (oAuth.Token.Length > 0)
                {
                    Session["token"] = oAuth.Token;


                    var post = new PostToWall();
                    post.Message      = "Test message from Thoris";
                    post.ArticleTitle = "A new rating has been posted";
                    post.AccessToken  = Session["token"].ToString();
                    post.Post();
                    Response.Write("The Facebook post successed with ID: " + post.PostID);
                    Response.Write("<br/>");
                    Response.Write("The error message was: " + post.ErrorMessage);

                    //oAuth.PublicarMensagem(Session["token"].ToString ());

                    Response.Redirect("~/Default.aspx");
                }
            }
        }
        public void CreateFbAccount(AuthFacebook account)
        {
            if (account != null)
            {
                Context.Set <AuthFacebook>().Add(account);
            }

            Context.SaveChanges();
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthFacebook oAuth = new AuthFacebook();

            if (Session["token"] == null)
            {
                Response.Redirect(oAuth.GetAuthorizationLink());
            }
            else
            {
                oAuth.Token = Session["token"].ToString();

                var    url  = "https://graph.facebook.com/me?access_token=" + oAuth.Token;
                string json = oAuth.Request(AuthFacebook.Method.GET, url, String.Empty);
                ltrJson.Text = json;
            }
        }
        public async void Login(Cloudbase cloudbase)
        {
            authFacebook = new AuthFacebook();
            FacebookClient facebookClient = await authFacebook.GetFacebookClient();

            if (facebookClient != null)
            {
                ServiceManager.Instence().FacebookClient = facebookClient;

                //跳转到文件扫描窗口
                UserControl detailControl = new FacebookDetailControl();
                MainWindowManager.Instence().MainVM.MiddleDataControl = detailControl;
            }
            else
            {
                MessageBox.Show("Auth facebook api failed!!!");
            }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string       url   = "";
            AuthFacebook oAuth = new AuthFacebook();


            if (Request["code"] == null)
            {
                Response.Redirect(oAuth.GetAuthorizationLink());
            }
            else
            {
                oAuth.GetAccessToken(Request["code"]);

                if (oAuth.Token.Length > 0)
                {
                    Session["token"] = oAuth.Token;
                    Response.Redirect("~/Default.aspx");
                }
            }
        }