我有这个控制器
[HttpPost]
public ActionResult Compose(ComposeMessage composeMessage)
{
var message = "";
dynamic fbPost = new ExpandoObject();
fbPost.message = composeMessage.Message;
dynamic result = FBHelper.PostInFacebook(fbPost, associatedAccount.ProviderAccessToken);
if (((IDictionary<String, object>)result).ContainsKey("error"))
{
Session["PostMessage"] = fbPost;
var redirectUrl = FBHelper.GetLoginUrl("email,read_stream,publish_stream");
//HttpContext.ClearError();
//the below redirect does not work
Redirect(redirectUrl);
//message = "Posting to Facebook failed. \n";
}
else
{
message = "Posting to Facebook successful. \n";
}
return Json(new { success = message });
}
如果我的访问令牌过期,我在这里要做的基本上是重定向到 Facebook OAuth。
但是代码Redirect(redirectUrl);
根本不会触发。我的问题是
- 代码有什么问题?
- 为什么重定向不触发?