开发者

Setting Facebook Setting programmatically and FacebookRedirect.axd

First I have searched a lot before asking ,so thanks in advance for any help Well I have one mvc solution Developed using Facebook C# sdk What i need to do is setting Facebook application settings problema开发者_开发技巧tically which i have done (why?) because i need more than Facebook application to use the same solution i retrieve the settings from the database ,well one application working great the other is redircting me to the application then FacebookRedirect.axd and do it like it is crazy from here to here

http://localhost:1365/facebookredirect.axd?code=-VgxfYdz8W6uX3xBdnX0k6INCKo-SoY_OruGXt-3_PQ.eyJpdiI6Ikpfa05LclFKb1lEWHlIdFZrMlE1OUEifQ.7L99gStiSUWltcYR7WYNM57ABbZrKAnAx3efxjMiwKAlF2zolMPQsnO-85REgUSDFWPF5rSuXVnQVYX286bqNLL6RJLJFBYqG22Th1_-yuM_IGO-pTgv4MlXal7evl47&state=eyJyIjoiaHR0cDovL2FwcHMuZmFjZWJvb2suY29tL3Zhc3RzdmVyaWdldnR3byIsImMiOiJodHRwOi8vd3d3LmZhY2Vib29rLmNvbSJ9

I set the settings in the right way that is why the first application works but the second give me the same result each time .


Hello every body I have figured what is the problem and thanks prabir for your help the problem was I was a new in Facebook application development the problem was i want to make more than one application use the same solution so there is no need the settings in the config file because i set them problematically on the run time and here is the peace of code i am using :

I create a class the implement ifacebookapplication whisch contain this method :

 private IFacebookApplication GetCurrent()
        {       
            RouteData UrlData = HttpContext.Current.Request.RequestContext.RouteData;

            FaceBookSettings fbSettings = FaceBookSettingsManager.GetFaceBookSettingsByAppId((string)UrlData.Values["appId"]);
            var FBApp = new DefaultFacebookApplication();

            FBApp.AppId=fbSettings.AppId;
            FBApp.AppSecret=fbSettings.AppSecret;
            FBApp.CancelUrlPath=fbSettings.CancelUrlPath;
            FBApp.CanvasPage=fbSettings.CanvasPage;
            FBApp.CanvasUrl=fbSettings.CanvasUrl;
            FBApp.SecureCanvasUrl=fbSettings.SecureCanvasURL;
            FBApp.SiteUrl=fbSettings.SiteUrl;
            FBApp.UseFacebookBeta = fbSettings.UseFacebookBeta;

            return FBApp;
        }

and within my application start I st this :

   FacebookApplication.SetApplication(new FaceBookApplicationSettings());

and within my config file i am not setting any configuration except :

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

that is all thanks alot :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜