从asp.net上发布facebook个人资料中的图片和文字 [英] Posting images and text on facebook profile from asp.net

查看:92
本文介绍了从asp.net上发布facebook个人资料中的图片和文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个gridview,其中有一个点击它的按钮

我在脸书上发布图像和文字当我在Facebook上发布内容时说(Facebook帐户1),帖子已成功发布在墙上

该帐户

然后我从该帐户退出



再次点击该按钮(我正在使用我的其他Facebook帐户登录)并尝试将内容发送到Facebook,但是它没有在该帐户上发布它正在获取发布在以前的Facebook帐户上



如果我从我的第一个帐户发布,然后如果我重新启动我的解决方案然后再次如果我从不同的Facebook帐户发送帖子它会得到在这个不同的帐户上成功发布



这是我的代码

 protected void Page_Load(object sender,EventArgs e) 
{
try
{
FaceBookConnect.API_Key = Con figurationManager.AppSettings [ FKEY]的ToString();

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


if(!IsPostBack)
{
string code = Request.QueryString [code]; //获取Facebook代码

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


#region在墙上发布的Facebook代码
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
}
}

//这是我的网格视图行命令事件
Session [ImagePath] = lnkimagepath.CommandArgument.ToString(); //获取// html文件的图像路径
Session [FilePath] = lnlpath.CommandArgument.ToString(); //得到html文件的文件路径
FaceBookConnect.Authorize(publish_actions,Request.Url.AbsoluteUri.Split('?')[0]);



 

解决方案

参考:

发布并分享用户的内容在ASP.Net中使用Graph API的FaceBook Wall [ ^ ]

使用ASP.Net中的Graph API将照片,图像或图片上传或发布到FaceBook墙上并发表评论 [ ^

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]);


解决方案

Refer:
Post Publish and Share content on user’s FaceBook Wall using Graph API in ASP.Net[^]
Upload or post photos, images, or pictures to FaceBook wall with comments using Graph API in ASP.Net[^]


这篇关于从asp.net上发布facebook个人资料中的图片和文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆