回传到MVC 3.0 Facebook应用程序时出现问题 [英] Problem when posting back to mvc 3.0 facebook app

查看:71
本文介绍了回传到MVC 3.0 Facebook应用程序时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了一个Facebook应用程序,将其配置为指向我的本地主机,并在facebook中创建了一个标签页以指向本地应用程序.

I have setup a facebook app, configured it to point to my localhost and created a tab in facebook to point to the local app.

所有工作正常,并且初始加载使我的页面正常运行,并且在我检查FacebookWebContext.Current.IsAuthenticated()时对用户进行身份验证.

All works fine and the initial load renders my page fine and the user is authenticated when I check FacebookWebContext.Current.IsAuthenticated().

我的问题是,当我发布数据时,facebook上下文丢失并且FacebookWebContext.Current.IsAuthenticated()返回false.

My problem is that when I post data back, the facebook context is lost and FacebookWebContext.Current.IsAuthenticated() returns false.

不确定我是否在这里遗漏了一些东西,但是可以确定我应该能够发回控制器操作并保持身份验证吗?

Not sure if I am missing something here, but surely I should be able to post back to controller actions and stay authenticated?

推荐答案

您需要手动维护已签名的回发请求.

you need to manually maintain the signed request for post backs.

<% if(!string.IsNullOrEmpty(Request.Params["signed_request"])) { %>
    <input type="hidden" name="signed_request" value="<%= Request.Params["signed_request"] %>" />
<% } %>

有关更多信息,请参考此讨论 http://facebooksdk.codeplex.com/discussions/255100

Refer to this discussion on more information http://facebooksdk.codeplex.com/discussions/255100

您还可以使用此html helper扩展方法

You could also use this html helper extensions method

@FacebookSignedRequest()

代替

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

这篇关于回传到MVC 3.0 Facebook应用程序时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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