我收到以下网址:
http://localhost:8080/facebook/Status#access_token=dsadsa
我尝试在方法Status()中解析它,但变量“Request.Url”是
http://localhost:8080/facebook/Status
如何解决这个问题?
public ActionResult Status()
{
FacebookOAuthResult result;
if (FacebookOAuthResult.TryParse(Request.Url, out result))
{
if (result.IsSuccess)
{
var accessToken = result.AccessToken;
var code = result.Code;
var app = new FacebookClient(fbm.appID, fbm.appSecret);
fbm.accessToken = app.AccessToken;
ViewData["accessToken"] = app.AccessToken;
fbm.isAuthorized = true;
}
else
{
var errorDesc = result.ErrorDescription;
var errorReason = result.ErrorReason;
fbm.isAuthorized = false;
ViewData["errorDesc"] = errorDesc;
ViewData["errorReason"] = errorReason;
}
}
return View();
}