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

  • SEARCH
  • Home
  • 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 7674751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:48:30+00:00 2026-05-31T16:48:30+00:00

I’m having some trouble getting my C# Facebook canvas app to determine if a

  • 0

I’m having some trouble getting my C# Facebook canvas app to determine if a user has authorized my app.

The problem is actually only occurring on a secondary page. My app initially checks on the landing page and properly determines that the user has validated the application.

Short overview of app:

  1. User likes app.
  2. User authorizes app.
  3. User sends info to a friend (via Facebook notification)
  4. Friend of user visits app and gets information.

So steps 1-3 work. Step 4 is where I’m having some issues.

I’m calling a method called “HasAuthorizedApplication” to ensure that the user has authorized the app before trying to get data from the API.

public bool HasAuthorizedApplication()
    {
        bool returnValue = false;

        try
        {
            if (FacebookWebContext.Current != null)
            {
                returnValue = FacebookWebContext.Current.IsAuthorized(Scope.Split(','));

                if (returnValue)
                {
                    AccessToken = FacebookWebContext.Current.AccessToken;
                    HttpContext.Current.Session["accesstoken"] = AccessToken;
                }
                else
                {
                    HttpContext.Current.Session["accesstoken"] = null;
                }
            }
        }
        catch
        {
            returnValue = false;
        }

        return returnValue;
    }

“Scope” is just the permissions I’m asking for: “publish_stream,email”

So in step 4, the ‘friend of the user’ clicks on the Facebook notification and hits the landing page of the app. It checks for authorization and if the friend hasn’t authorized, the auth dialog is presented.

After authorizing, the app redirects to the secondary page and before I get the details of the notification from the graph, I check again to ensure the friend has still authorized the app.

Unfortunately, when I call it this time, “FacebookWebContext.Current.IsAuthorized” always returns “false.” I note that the “AccessToken” and “SignedRequest” are null at this time. I attempt to redirect back to the authorization dialog, but as the friend has already validated, it doesn’t show to the user. But each time they return back to my secondary page, the “IsAuthorized” call returns false. (and if I try to just get the data, additionally returns false)

My call to get the data surrounding the Facebook notification:

public dynamic GetData(string dataId)
    {
        if (HasAuthorizedApplication())
        {
            var fb = new FacebookWebClient(AccessToken);
            dynamic data = fb.Get(dataId);

            return data;
        }

        return null;
    }

Where “dataId” is the id of the notification.

Admittedly, I don’t know much about how the interactions between the Javascript and backend work. I additionally have the following Javascript on both the landing and secondary pages:

<script type="text/javascript">
            FB.init({
                appId: '<%=APPID %>',
                status: true, // check login status
                cookie: true, // enable cookies to allow the server to access the session
                oauth: true,
                xfbml: true // parse XFBML
            });

        </script>

And ideas why it would work properly on one page and not another?

Thanks!
Craig

  • 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-05-31T16:48:31+00:00Added an answer on May 31, 2026 at 4:48 pm

    I know this isn’t exactly the answer you are looking for, but FacebookWebContext is part of the Facebook C# SDK V5 and is being deprecated. There are several issues with it, most importantly that it depends on ready Facebook’s auth cookies. Facebook recently made a change to their policies that indicated that developers should no longer read the Facebook cookies directly as they may change at any time. As such we have removed these features in V6 of the Facebook C# SDK.

    That being said, you should handle nearly all of what you are trying to do above with the Facebook Javascript SDK on the client rather than with the C# SDK on the server. You can use the Facebook C# SDK on the server to perform final validation.

    As such, I would recommend you upgrade to V6 of the Facebook C# SDK which does not use the Facebook cookies or contain the FacebookWebContext object.

    You can find the full documentation for the Facebook C# SDK at http://csharpsdk.org.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.