Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi

I have a gridview in which there is a button on clicking it
I am posting images and text on face book when i post content on facebook with say (facebook account 1) the post is getting posted on the wall successfully
on that account
Then i log out from that account

Again i click on that button (I am signing in with my other facebook account) and trying to send content to the facebook it is not getting posted on that account it is getting posted on the previous facebook account

If i post from my first account and then if i restart my solution and then again if i sent post from different Facebook account it is getting posted sucessfully on that diffrent account

Here is my code
protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                FaceBookConnect.API_Key = ConfigurationManager.AppSettings["Fkey"].ToString();

                FaceBookConnect.API_Secret = ConfigurationManager.AppSettings["FSECRET"].ToString();


                if (!IsPostBack)
                {
                    string code = Request.QueryString["code"];//get the facebook code

                    ViewState["code"] = Request.QueryString["code"];

                    
                    #region facebook code for posting onthe wall
                    if (!string.IsNullOrEmpty(code))
                    {
                        

                        Dictionary<string, string> data = new Dictionary<string, string>();
                      
                        data.Add("link", "http://www.codeproject.com/Articles/122379/MonitorRouterIP");
                        data.Add("picture", Session["ImagePath"].ToString());
                        data.Add("caption", "");
                        data.Add("name", "");
                        data.Add("message", "test");

                        FaceBookConnect.Post(ViewState["code"].ToString(), "me/feed", data);
                        Session["File"] = null;
                        Session["Message"] = null;
                      
                      
                    }
                    #endregion
                }
            }

//And this is my grid view row command event
 Session["ImagePath"] = lnkimagepath.CommandArgument.ToString();//get the image path of the //html file
 Session["FilePath"] = lnlpath.CommandArgument.ToString();//get he filepath of the html file
                FaceBookConnect.Authorize("publish_actions", Request.Url.AbsoluteUri.Split('?')[0]);


Posted
Updated 15-Sep-13 20:41pm
v2

1 solution

 
Share this answer
 
Comments
rocky_em 16-Sep-13 2:49am    
Thank for replying i followed that article and i made the application i am able to post image and text on facebook but
when i post content on facebook with say (facebook account 1) the post is getting posted on the wall successfully
on that account
Then i log out from that facebook account

Again i click on that button(My button is in the gridview) (I am signing in with my other facebook account) and trying to send content to the facebook it is not getting posted on that account it is getting posted on the previous facebook account
that is the problem :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900