Facebook SDK 4.2.1 - http 404 error, after permissions 'allow'

亡梦爱人 提交于 2019-12-13 20:25:17

问题


I have small problem with http 404 error, after click on 'allow' on facebook permissions page.

When I type http://localhost:port address in browser, I get same error:

cannot find /facebookredirect.axd/[app name]/default.aspx

After granting permissions (and after 404 error), when I want to use my app, I'm running it from my profile. Everything is fine and app works well.


回答1:


I had a similar problem some time ago, I changed my web.config file, see the following:

I added this to the httpHandlers section in system.web:

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

And added this to the handlers section in system.webServer:

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

And lastly I set the Url's in the codebehind (this should post back to the original app url and you'll see the variables added depends on what the user clicks):

CanvasAuthorizer cAuthorizer = new CanvasAuthorizer();
cAuthorizer.ReturnUrlPath = HttpUtility.UrlEncode("?allow=true");
cAuthorizer.CancelUrlPath = HttpUtility.UrlEncode("?allow=false");

Make sure you are setting your facebook settings in the config file, e.g:

<facebookSettings appId="0000000" appSecret="0000000000" canvasPage="http://apps.facebook.com/xxxxx/" canvasUrl="http://xxxxxxx" secureCanvasUrl="https://xxxxxxx"/>

I'm not 100% sure if I used the same SDK version, but give it a try.




回答2:


You need to setup your web.config file correctly. See the getting started documentation for instructions on how to do that: http://facebooksdk.codeplex.com/wikipage?title=Getting%20Started&referringTitle=Documentation



来源:https://stackoverflow.com/questions/4712100/facebook-sdk-4-2-1-http-404-error-after-permissions-allow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!