How can I log a user out from my facebook connect website, without using the fb-login button? I would like to do it from codebehind (c#)?
I found out that there was only an option to do it from Javascript by FB.Connect.logout(). It seems kinda wird that there is no API from codebehind to do the same.
At least in the php api there is a logout method. In order for it to work the logout method redirects the user to an url in facebook.com and then redirects you back to your site
$facebook->logout( "http://site.com/returnAfterLogout.php" )
However i have found that in that request the javascript api still thinks the php api still thinks he is logged in and until you try to do an api request it will raise an exception.
I hope the developers will use some more time to extend the .net facebook framework so it will reflect the php a bit more, and not be so lacking as it is at the moment.
My painful experience showed me you MUST have a return(false); after the FB.Connect.logout(); call like in :
FB.Connect.logout(doOnUserLogout()); return(false);
Otherwise it'll seem like it is logging out, with the modal dialog box stating so, but it will not log the user out.
I found this out by chance as it was again not documented.
seems ConnectSession doesn't have any codes in Logout methd. Its just
void Logout(){ }
without anything. same for Login(){}
so basically u will need to use the java-script version