开发者

ASP.NET [Facebook API] - Reading a signed_request with C# (given only as PHP in fb docs as PHP)

开发者 https://www.devze.com 2023-04-04 04:33 出处:网络
How? I tried everything, I couldn\'t do it. All I see is PHP code, I tried browsing through stackoverflow, tri开发者_如何学编程ed searching online (google, yahoo, etc.), but no where did I find an ans

How? I tried everything, I couldn't do it. All I see is PHP code, I tried browsing through stackoverflow, tri开发者_如何学编程ed searching online (google, yahoo, etc.), but no where did I find an answer. I saw some post here saying to use:

string requested_Data = Request.Form["signed_request"];
var DecodedSignedRequest = FacebookSignedRequest.Parse(appSecret, requested_Data);

Unfortunately, requested_Data always returns null (and no, it is not a redirect). I'm not even sure if the second line works since I can't even get past the first line. I tried

Request.QueryString.Get("signed_request");

and it did not work... What is the problem with requested_Data always being null? Please assist!


did you try putting Html.FacebookSignedRequest() into your form? What is the form action to? Are you using MVC? Post some code to see if we can figure it out


Make sure that you have setup config values correctly for facebook in config file. (APPID, APPSECRET etc.) Also did you try using Request.Param["signed_request"]; instead?


var signedReuest = FacebookWebContext.Current.SignedRequest;


You might find that you didn't set up an app on Facebook. If you ONLY set up a 'Page Tab', the signed request never gets sent. This drove me nuts for ages. If you want to program a fan gate you MUST set up your app to be both a 'Page Tab' and an 'App on Facebook'

0

精彩评论

暂无评论...
验证码 换一张
取 消