Facebook logout C# SDK

Rauland picture Rauland · May 16, 2011 · Viewed 7.8k times · Source

Hi
I am having trouble trying to logout of facebook using the FB C# SDK.

Here's a sample of my test

var oauth = new FacebookOAuthClient();
                    oauth.AppId = fbSection.AppId;
                    string bbc = @"http://www.bbc.co.uk";
                    var logoutParameters = new Dictionary<string, object>  {{ "next", bbc }} ;
                    this.NavigateUrl = oauth.GetLogoutUrl(logoutParameters).AbsoluteUri;  

The problem is that it´s always redirecting to:

http://m.facebook.com/ 

I'm trying to redirect to an external site in this case bbc.co.uk, as in first case I tried redirecting to localhost and had the same problem.

I really wouldnt like to implement a javascript solution as I have already implemented my login functionality server side.

Any suggestions much appreciated.

Answer

Rauland picture Rauland · May 17, 2011

After some time searching I came across this post: http://forum.developers.facebook.net/viewtopic.php?id=87109

which suggests to call:

this.NavigateUrl =  https://www.facebook.com/logout.php?next=[redirect_uri]&access_token=[access_token]

Which worked for me.