我的Facebook SDK for MVC3存在问题[1]:http://docs.csharpsdk.org/
每次回发时我都丢失了会话和当前上下文。我需要帮助!
CODE
public class OverviewController :Controller
{
public readonly FacebookClient _fb;
public readonly IMyFacebookCanvasContext _fbCanvasContext;
private readonly string[] ExtendedPermissions = new[] { "user_about_me", "publish_stream", "read_stream" };
public OverviewController(FacebookClient fb, IMyFacebookCanvasContext fbCanvasContext)
{
_fb = fb;
_fbCanvasContext = fbCanvasContext;
}
public ActionResult Index()
{
dynamic result = _fb.Get("me", new { fields = new[] { "name", "picture" }
return View();
}
}
我使用了这个例子[1]:https://github.com/facebook-csharp-sdk/facebook-canvas-mvc
答案 0 :(得分:0)
您需要手动维护signed_request以进行回发和ajax请求。 https://stackoverflow.com/a/5364815/157260
答案 1 :(得分:0)
只需将其添加到您的global.asax:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("p3p", "CP=\"CAO PSA OUR\"");
}