Mic*_*dze 0 c# facebook facebook-graph-api
我在我的MVC应用程序中使用从Nuget下载的C#Facebook SDK https://github.com/facebook-csharp-sdk/facebook-csharp-sdk从页面获取公共相册.
除了一个,当我试图获得专辑封面时,所有请求都可以正常工作.
var PictureUrl = "1713516952246958/picture";
var PictureResult = FB.Get(PictureUrl);
Run Code Online (Sandbox Code Playgroud)
它抛出异常"未知的Facebook响应".
相同的请求在这里工作
任何想法应该是什么问题?
我有完全相同的问题,它让我疯了.
最后我想查看文档:https: //developers.facebook.com/docs/graph-api/reference/user/picture/
基本上它说:
By default this edge will return a 302 redirect to the picture image. To get access to the data about the picture, please include **redirect=false** in your query.
因此,您获得的"未知的Facebook响应"错误是因为返回了有效的JSON,而实际上正在返回302重定向.哪个当然无法正确解析
因此,请尝试将代码更改为:
var PictureUrl = "1713516952246958/picture?redirect=false";
var PictureResult = FB.Get(PictureUrl);
Run Code Online (Sandbox Code Playgroud)
你应该很甜蜜!