I am trying to create an asp.net web application, in which when user logins with Facebook through my application, the friends of that user will be displayed in the application.
Now i want to create a Facebook Logout button so that user can log out also. I tried one code
HTML:
<asp:ImageButton ID="imgLogout" runat="server" OnClientClick="FB_Logout()" ImageUrl="~/logout.jpg"/>
Script:
<script type="text/javascript">
function FB_Logout() {
alert('Are you sure?')
FB.Connect.logoutAndRedirect("http://localhost:2708/List.aspx");
}
</script>
it was working fine. But now user can not logout. Clicking on Facebook Login Button directly opens the already logged in user.
I think you might be using an old SDK.
According to the recent JS SDK you would use FB.logout
as in: https://developers.facebook.com/docs/reference/javascript/FB.logout/
Also because you want to redirect you could either redirect straight after the logout code with
or hook on the logout event in Facebook and do the redirect. e.g.