Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8338989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:45:39+00:00 2026-06-09T04:45:39+00:00

I have been looking through quite a few posts on StackOverflow and on the

  • 0

I have been looking through quite a few posts on StackOverflow and on the internet on being able to log a user out of Facebook through an ASP.NET LinkButton.

I have tried implementing solutions from the following posts:

  • Facebook Logout button in asp.net web application
  • How to logout from facebook connect in asp.net?
  • Facebook Logout Confusion

Code

ASPX Page

<asp:LinkButton ID="LogoutButton" CssClass="log-out fb"  OnClick="LogoutButton_Click" runat="server">Logout</asp:LinkButton>

JavaScript

$(".log-out.fb").click(function () {
    FB.logout(function (response) {
        //Logged out
        FB.Auth.setAuthResponse(null, 'unknown');
    });
});

HTML Output

<a id="MainContent_LogoutButton" class="log-out fb" href="javascript:__doPostBack('ctl00$MainContent$LogoutButton','')" style="width: 66px; ">Logout</a>

I definitely know that the jQuery click event is getting fired when debugging via Firebug. The jQuery code works fine when used in conjunction with a standard HTML anchor, so there is no reason for it not to work on a ASP.NET LinkButton.

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:45:42+00:00Added an answer on June 9, 2026 at 4:45 am

    Thanks for all your help. But I managed to find a way to log out a user by using the following link:

    https://www.facebook.com/logout.php?next=YOUR_URL&access_token=ACCESS_TOKEN
    

    I created a callback page similar to the one from this article. Once I received the “access token”, I managed to log the user out.

    Here is my code for my callback page:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(Request["code"]) && !Page.IsPostBack)
        {
            FacebookCallback();
        }
    }
    
    private void FacebookCallback()
    {
        var client = new RestClient { Authority = "https://graph.facebook.com/oauth/" };
        var request = new RestRequest { Path = "access_token" };
    
        request.AddParameter("client_id", ConfigurationManager.AppSettings["facebook.appid"]);
        request.AddParameter("redirect_uri", ConfigurationManager.AppSettings["facebook.logout.callbackurl"]);
        request.AddParameter("client_secret", ConfigurationManager.AppSettings["facebook.appsecret"]);
        request.AddParameter("code", Request["code"]);
    
        RestResponse response = client.Request(request);
        // A little helper to parse the querystrings.
        StringDictionary result = QueryStringHelper.ParseQueryString(response.Content);
    
        string aToken = result["access_token"];
    
        LogUserOut(aToken);
    }
    
    private void LogUserOut(string sToken)
    {
        string url = String.Format("https://www.facebook.com/logout.php?next=http://{0}/Default.aspx&access_token={1}", ConfigurationManager.AppSettings["site.url"], sToken);
    
        Response.Redirect(url);
    }
    

    I hope this helps others if they encounter the same issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have been through most of the questions here. Also quite a few
I have been looking through the source code for the Flash-based Google TV example
I have been looking through code for the last 3 days, and the original
I have been looking through some code on an open source project recently and
I am interested in using a DataObject and have been looking through the documentation.
OK, I have been looking for weeks now. I have looked through Eclipse and
I have been looking into backbone.js and I can't seem to figure out how
I have been looking for quite some time for an answer to this, and
I have been reading through the CodePlex supported open source licenses, i couldn't quite
I've been looking through the internet a long time now for an easy solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.