与母版页的Iframe应用帆布 [英] Iframe Canvas application with Master Page

查看:220
本文介绍了与母版页的Iframe应用帆布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的iframe画布应用。

I am developing an Iframe-Canvas Application.

我使用的母版页来获得访问权限功放及;显示一些细节,即做工不错。

I am using Master Page to gain permission access & display few details, that works good.

然后在内容页我想显示一个文本框和放大器; LinkBut​​ton的所以用户可以张贴在他们的墙上和放状态;在这里,我得到错误

Then on content Page I want to display a textbox & linkbutton so user can post status on their wall & here I get error

(OAuthException)有效的访问令牌,必须使用查询有关当前用户的信息。

这是我的code:

Site.master.cs

Site.master.cs

protected void Page_Load(object sender, EventArgs e)
{
    var auth = new CanvasAuthorizer { Permissions = new[] { "user_about_me","user_birthday","user_location","offline_access","publish_stream" } };

    if (auth.Authorize())
    {
        ShowFacebookContent();
    }
}
private void ShowFacebookContent()
{
    var fb = new FacebookWebClient();
    dynamic myInfo = fb.Get("me");
    lblName.Text = myInfo.name;
    imgProfile.ImageUrl = "https://graph.facebook.com/" + myInfo.id + "/picture";
    lblBirthday.Text = (myInfo.birthday == null ? string.Empty : DateTime.Parse(myInfo.birthday).ToString("dd-MMM-yy"));
    lblHometown.Text = (myInfo.hometown.name == null ? string.Empty : myInfo.hometown.name);
    lblLocation.Text = (myInfo.location.name == null ? string.Empty : myInfo.location.name);
    pnlHello.Visible = true;
}

Default.aspx.cs

Default.aspx.cs

protected void Page_Load(object sender, EventArgs e)
{

}

public void LinkButton1_Click(object sender, EventArgs e)
{
    var fb = new FacebookClient("access_token");
    //var fb = new FacebookWebClient();

    dynamic feedparameters = new ExpandoObject();
    feedparameters.message = (message_txt.Text == null ? " " : message_txt.Text);
    feedparameters.user_message_prompt = "userPrompt";

    dynamic result = fb.Post("me/feed", feedparameters);
}

我是pretty新FacebookSDK所以任何帮助将是非常美联社preciated。

I am pretty new to FacebookSDK so any help will be really appreciated.

推荐答案

WEL终于发现是什么问题。需要添加一个隐藏字段。

Wel finally found what was the problem. Needed to add a hidden field.

<input type="hidden" name="signed_request" value="<%: Request.Params["signed_request"]%>"/>

我觉得这既不提到的文档中也不在提供的样品任何地方。

I think this is neither mentioned any where in the documentation nor in the Provided Samples.

这篇关于与母版页的Iframe应用帆布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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