I have this code that was using Facebook C# API v5 and was running on a AJAX call to figure out if user is authenticated:
// Make sure user is logged into Facebook and authroized this application
if (!FacebookWebContext.Current.IsAuthenticated() ||
!FacebookWebContext.Current.IsAuthorized(new[] { "email" }))
{
result.ResultCode = BasicResultCode.NotAuthorized;
return result;
}
var fbuid = FacebookWebContext.Current.UserId;
In v6, Facebook.Web namespace doesn’t exist and FacebookWebContext is nowhere to be found. What do I use instead for the above code?
I’m not sure if this will help you or not, but as far as I understand, Facebook removed these features from the c# sdk because they wanted to change the structure of some Facebook cookies. By removing FacebookWebContext they/you don’t risk running into issues where the cookie structure might have changed and things are no longer compatible.
Instead, I think you should try to do your authentication through the Facebook Javascript SDK
Try using
FB.getLoginStatus and/or
FB.getAuthResponse