Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
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

C#
<div class="pre-action-link" id="premain0" width="100%"></div>
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,> data = new Dictionary<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 16-Nov-13 0:39am
v2
Comments
surajemo 16-Nov-13 7:45am    
Uploaded the new dll and and after posting i worote this code
FaceBookConnect.Post(ViewState["code"].ToString(), "me/feed", data);

FaceBookConnect.Logout(Request.QueryString["code"]);

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