我正在尝试使用以下代码更新 Facebook 排行榜上的用户分数:
string _url = "https://graph.facebook.com/MY_APP_ID/scores";
var _parameters="score=100&access_token=MY_APP_TOKEN_WITH_PUBLISH_ACTION";
WebRequest _request = WebRequest.Create(_url);
_request.Method = "POST";
var _dataArray = Encoding.ASCII.GetBytes(_parameters.ToString());
_request.ContentLength = _dataArray.Length;
using (Stream _dataStream = _request.GetRequestStream())
{
_dataStream.Write(_dataArray, 0, _dataArray.Length);
}
WebResponse _response = _request.GetResponse();
当我尝试获取响应时,应用程序会引发异常:
远程服务器返回错误:(400) 错误请求。
我究竟做错了什么?