开发者

Problem to redirect the user to startpage

I have read many threads about this, but i haven't found a solution that works.

I have problem with the Facebook C# SDK. I can't redirect the user to the startpage. I think there is a problem with facebookredirect.axd. Whats that? Way can't i send the user to the startpage for my app? When i enter the startpage for my facebook app, i will be redirected to the permission page, and when i accept the permission, i will be redirected to the startp开发者_高级运维age of facebook (www.facebook.com). Why? Why not to my app?

This is the url on the permission page: http://www.facebook.com/connect/uiserver.php?app_id=&method=permissions.request&display=page&next=http%3A%2F%2Flocalhost%3A2143%2Ffacebookredirect.axd&response_type=code&state=eyJyIjoiaHR0cDovL2FwcHMuZmFjZWJvb2suY29tL2Jhcm5kYWdib2tlbi9EZWZhdWx0LmFzcHgifQ&fbconnect=1&perms=email

If i manually change facebookredirect.axd to facebookredirect.axd/Default.aspx (in the url) it's work, but must the visitors do that?

This is a bit of my web.config:

<configSections>
    <section type="Facebook.FacebookConfigurationSection, Facebook" name="facebookSettings" allowLocation="true" allowDefinition="Everywhere" />
    <section name="canvasSettings" type="Facebook.Web.CanvasConfigurationSettings, Facebook.Web" />
  </configSections>

  <facebookSettings canvasPage = "http://apps.facebook.com/<APPNAME>/" secureCanvasUrl="http://localhost:2143/" canvasUrl="http://localhost:2143/" appSecret="" appId="" cancelUrlPath = "" />
  <canvasSettings canvasUrl="http://localhost:2143/" canvasPageUrl="http://apps.facebook.com/<APPNAME>/" authorizeCancelUrl="http://facebook.com"/>

      <httpHandlers>
    <add verb="*" path="/" type="System.Web.UI.Page"/>
      <add verb="*" path="facebookredirect.axd" type="Facebook.Web.FacebookAppRedirectHttpHandler, Facebook.Web" />

  </httpHandlers>

    <handlers>
      <add name="facebookredirect.axd" verb="*" path="facebookredirect.axd" type="Facebook.Web.FacebookAppRedirectHttpHandler, Facebook.Web" />
    </handlers>

I have create a map with name facebookredirect.axd and ádd a web.config file in it with this:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <httpHandlers>
      <clear/>
      <add path="*" verb="*" type="Facebook.Web.FacebookAppRedirectHttpHandler, Facebook.Web" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <handlers>
      <clear/>
      <add name="facebookredirect" path="*" verb="*" type="Facebook.Web.FacebookAppRedirectHttpHandler, Facebook.Web" />
    </handlers>
  </system.webServer>
</configuration>

On the startpage (Default.aspx) i have this:

        CanvasAuthorizer auth = new CanvasAuthorizer { Permissions = new[] { "email" } };

        if (auth.Authorize())
        {
            FacebookWebClient client = new FacebookWebClient();
            dynamic parameters = new ExpandoObject();
            parameters.fields = "id, name, third_party_id, username";
            dynamic result = client.Get("me", parameters);
        }

When i build this site with Facebook javascript sdk its worked perfect, and now when i try the Facebook C# SDK the page is "broken"....

What have i done wrong?

Grateful for any help!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜