问题
In my fb application I calling a post action
$.post("http://localhost:3435/Home/Try?id=123&x=1");
My action
[HttpPost]
public ActionResult Try(string id, int x)
{
//post on my wall
var client = new FacebookWebClient();
dynamic parameters = new ExpandoObject();
//...
dynamic result = client.Post("me/feed", parameters);
//...
}
In FF and chrome this works as expected. Posts to wall. But in Internet Explore I get an exception. (OAuthException) An active access token must be used to query information about the current user.
Some answers in similar question suggested to get the acces token from the FacebookSetting, but this seems to be null when debugged. I find this very strange since this works in FF and Mozilla.
回答1:
You will need to manually maintain the signed_request for post backs or ajax requests.
Pass signed_request as a parameter to your ajax post request.
More details at http://facebooksdk.codeplex.com/discussions/251878 and http://facebooksdk.codeplex.com/discussions/250820
回答2:
hmm check if IE has flash installed for x-domain communication, if not, try installing, also try hitting the apps.facebook.com/yourapp instead of going directly to the iframe
oh 1 other thing it could be if it's an iframe, is 3rd party cookies, try adding header('P3P: CP=HONK'); to your php code
来源:https://stackoverflow.com/questions/7224698/oauthexception-with-post-action-only-in-ie