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 7637513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:57:34+00:00 2026-05-31T07:57:34+00:00

I have a fairly simple site which allow users to connect via facebook. I

  • 0

I have a fairly simple site which allow users to connect via facebook.

I am using C# facebook sdk MVC.

At first i didn’t need any specific permission so there were no problems for users to connect. my code looked like this

public class FacebookController : BaseController
{
    public FacebookSession FacebookSession
    {
        get { return (new CanvasAuthorizer().Session); }
    }
    public ActionResult Profile()
    {
        var client = new FacebookClient(this.FacebookSession.AccessToken);
        dynamic me = client.Get("me");
        ViewBag.Name = me.name;
        ViewBag.Id = me.id;
        return View();
    }
}

and on my webconfig

<facebookSettings appId="XXXXXXXXXXXXXX" appSecret="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>

After a while I needed more specific permissions so I added CanvasAuthorize to my action – as so

[CanvasAuthorize(Permissions = "user_about_me,user_relationships,email,publish_stream")]
public ActionResult Profile()

That got me this exception:
Exception Details: System.Exception: CanvasUrl is null or empty

So I added to my Webconfig the canvasUrl which got me the same error with out the canvasPage So now my web config has all 4

<facebookSettings appId="XXXXXXXXXX" appSecret="XXXXXXXXXXXXXXXXXXXXx" canvasUrl = "http://localhost:60606/" canvasPage = "https://apps.facebook.com/XXXXXXXXXXXX/"/>

So now my user can log in via facebook, my problem is that when he does log in he is getting redirect to my Facebook app (http://apps.facebook.com/XXXXXXXXX/facebook/profile)

instead back to my site(http://localhost:60606/facebook/profile)

How can I get the Permissions that i need and redirect my user back to my site after he logs in?

Thanks

  • 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-31T07:57:35+00:00Added an answer on May 31, 2026 at 7:57 am

    Well, My bad

    CanvasAuthorize is just as it sounds, authorization for canvas.
    So you cannot use it without an app canvas on facebook.

    What I should have done is use the FacebookOAuthClient

    var oAuthClient = new FacebookOAuthClient(FacebookApplication.Current);
    oAuthClient.RedirectUri = new Uri("XXXXXXXXXXXXXX");
    var loginUri = oAuthClient.GetLoginUrl(new Dictionary<string, object> { { "state", null }, { "scope", "user_about_me,user_relationships,email" } });
    return Redirect(loginUri.AbsoluteUri);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple set of functionality for which I have multiple implementations,
I have a fairly simple code, a button click event, with the first line
I have a fairly simple ASP.NET 2.0 menu control using a sitemap file and
I have a fairly simple website where users can fill out a form describing
I have a fairly simple block of code. Sub Run(Name) on error resume next
I have a fairly simple python loop that calls a few functions, and writes
I have a fairly simple cell in a table with an inline style: <td
I have a fairly simple Linq query (simplified code): dim x = From Product
I have a fairly simple math operation I'd like to perform on a array.
I have a fairly simple class that I want to save to SQL Server

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.