Facebook粉丝专页应用传递字符串到app_data并检索 [英] Facebook fan page app pass string to app_data and retrieve

查看:158
本文介绍了Facebook粉丝专页应用传递字符串到app_data并检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多页面Facebook的粉丝页面应用程序在asp.net c#。我如何设置和检索该app_data querystring?是这部分的签名请求或实际的网页的粉丝页面?我可以使用以下命令获得signed_request:



如果(!string.IsNullOrEmpty(signedRequest))
{
动态SignedRequestData;

  
var DecodedSignedRequest = FacebookWebContext.Current.SignedRequest.Data;
SignedRequestData = DecodedSignedRequest

所以基本上在第一页我想得到signed_reqeuest使用然后将其附加到app_data querystring中的url。在所有其他请求我可以得到这一点,并使用这些值来检查用户状态,喜欢,登录等。这样我认为这将阻止跨域cookie问题在safari。任何人都同意或不同意这一点?



有没有人这样做?



欢呼

解决方案

您可以将 app_data 设置为:



https://www.facebook.com/ {PAGE_ID} SK = {APP_ APP_ID}&安培; app_data文件= { KEY1: VALUE1, KEY2: VALUE2}



您可以将多个值传递到 app_data 中,并将其返回 signed_request 以您的实际页面(POST数据)。



您应该做的是获取 signed_request 在第一页从POST加载,并将其添加到您的应用程序的URL为 ...?signed_request = {signed_request_string} 。每个页面都应该在URL中传递,以便您可以轻松查看,如 admin 页。您不需要为此使用 app_data 。无论如何,在应用程序中随后的任何点击/重定向之后,数据将会丢失。


Hi i have a multiple page facebook fan page app in asp.net c#. how do i set and retrieve that app_data querystring? is this part of the signedrequest or the actual url of the fan page? will there be cross domian issues in getting this in safari and ie?

i can get the signed_request using the following:

 if (!string.IsNullOrEmpty(signedRequest))
{
    dynamic SignedRequestData;
    var DecodedSignedRequest = FacebookWebContext.Current.SignedRequest.Data;
    SignedRequestData = DecodedSignedRequest

so basically on the first page i want to get the signed_reqeuest using the above and then append this to the url in app_data querystring. on all other requests i can then get this and use those values to check user status, liked, logged in etc. This way i think it will stop the cross domain cookie issues in safari. anyone agree or disagree with this?

has anyone done this?

cheers

解决方案

You can set the app_data as:

https://www.facebook.com/{page_id}?sk=app_{app_id}&app_data={"key1":"value1","key2":"value2"}

You can pass multiple values into app_data and it will be returned in the signed_request to your actual page as (POST data).

What you should really do is get the signed_request on first page load from POST, and add it to the URL of your app as ...?signed_request={signed_request_string}. Every page should then pass this around in the URL so you can easily check the like and admin status from any sub-page. You don't need to use app_data for this. And in any case, the data will be lost after the any subsequent click / redirect in your app.

这篇关于Facebook粉丝专页应用传递字符串到app_data并检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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