I am trying to create a Facebook “fangate” tab or an “Open” tab for a Facebook page.
You know how this happens - when a user visits a page, they are shown one bit of content if they have not clicked “How” and one more time.
I'm not a PHP guy, so I'm trying to do it using the Facebook C # SDK ( http://facebooksdk.codeplex.com ) in Visual Studio I'm also pretty new to .NET, so I'm not doing it that well!
I have to admit that I cut and pasted the code on all sides to make it work, and I think I'm almost there, but I am not getting this error:
Invalid signed request.
Line 82: var DecodedSignedRequest = FacebookSignedRequest.Parse (current, FacebookWebContext.Current.SignedRequest.Data.ToString ());
Here is my code:
var settings = ConfigurationManager.GetSection("facebookSettings");
var current = settings as IFacebookApplication;
var DecodedSignedRequest = FacebookSignedRequest.Parse(current, FacebookWebContext.Current.SignedRequest.Data.ToString());
dynamic SignedRequestData = DecodedSignedRequest.Data;
var RawRequestData = (IDictionary<string, object>)SignedRequestData;
string currentFacebookPageID = current.AppId;
bool currentFacebookPageLiked = false;
if (RawRequestData.ContainsKey("page") == true)
{
Facebook.JsonObject RawPageData = (Facebook.JsonObject)RawRequestData["page"];
if (RawPageData.ContainsKey("id") == true)
currentFacebookPageID = (string)RawPageData["id"];
if (RawPageData.ContainsKey("liked") == true)
currentFacebookPageLiked = (bool)RawPageData["liked"];
}
if (currentFacebookPageLiked)
{
}
else
{
}
All the Facebook settings are in my web.config file, and I checked that the AppID and AppSecret are correct.
Can someone suggest me any understanding of this problem? Is there a better way to do this that I haven't found yet?
Thanks so much for any help.
source
share