2012-01-17 2 views
1

iframe을 사용하여 asp.net facebook 응용 프로그램을 만들었습니다. 페이지에 사용 권한을 추가 할 때까지 URL http://apps.facebook.com/myappname에 제대로 표시되었습니다. facebook.dll을 사용하여 facebook.Components.FacebookService 클래스를 사용하고이 클래스를 사용하여 인증 토큰 등을 확인했습니다. 응용 프로그램 캔버스 페이지가 비어있는 것처럼 보였습니다. 그러나 캔버스 URL (예 : http://myappname.mydomainname.com)로 사용했던 브라우저 위치 표시 줄에 실제 사이트 URL을 입력하면 사용 권한을 요청하는 응용 프로그램의 프롬프트가 표시됩니다. 누군가 내가 잘못하고있는 곳을 안내해 줄 수 있습니까? 이러한 종류의 문제점으로내 페이 스북 Iframe 응용 프로그램이 빈 캔버스를 표시하는 이유

_fbService.ApplicationKey = FACEBOOK_API_KEY; 
     _fbService.Secret = FACEBOOK_SECRET; 
     _fbService.IsDesktopApplication = false; 
     string sessionKey = Session["Facebook_session_key"] as String; 
     string userId = Session["Facebook_userId"] as String; 
     // When the user uses the Facebook login page, the redirect back here 
     // will will have the auth_token in the query params 
     authToken = Request.QueryString["auth_token"]; 
     // We have already established a session on behalf of this user 
     if (!String.IsNullOrEmpty(sessionKey) && !String.IsNullOrEmpty(userId)) 
     { 

      _fbService.SessionKey = sessionKey; 
      _fbService.uid = Convert.ToInt64(userId); 
     } 
      // This will be executed when Facebook login redirects to our page   

     else if (!String.IsNullOrEmpty(authToken)) 
     { 
      try 
      { 
       _fbService.CreateSession(authToken); 
       Session["Facebook_session_key"] = _fbService.SessionKey; 
       Session["Facebook_userId"] = _fbService.uid; 
       Session["Facebook_session_expires"] = _fbService.SessionExpires; 

      } 
      catch (Exception) 
      { 

       Response.Redirect(@"http://www.Facebook.com/login.php?api_key=" + _fbService.ApplicationKey + @"&v=1.0\"); 
      } 
     } 
     // Need to login   
     else 
     { 
      Response.Redirect(@"http://www.Facebook.com/login.php?api_key=" + _fbService.ApplicationKey + @"&v=1.0\"); 
     } 

     facebook.Schema.user usr = _fbService.users.getInfo(); 
     //User usr = _fbService.GetUserInfo(); 
     // string t = string.Format("User Name:{0}, Sex:{1}, Location: {2}", usr.first_name, usr.sex, usr.current_location.city); 
     GetUsersFriendsList(); 
     // GetUserName(usr); 
     // SetControlVisibility(_fbService.uid.ToString()); 
    } 

답변

2

는, 당신이 겪고있는 문제 즉 자바 스크립트 문제 나 서버 측의 문제 클라이언트 측에 의한인지에 일찍 결정하는 것이 가장 좋습니다.

의 클라이언트 측 문제 해결을 시작하자 :

  • 열기 브라우저에 대한 개발자 콘솔 (예 : CTRL + SHFT + PC에 크롬 I)
  • 당신이 따라 빨간색 텍스트 오류를 ​​볼 수 있나요 아래 내 스크린 샷? , 페이스 북 API와 함께이 주로 사용하는 클라이언트 측 요청 - 그렇다면, 당신은 우리가 Browser console with error

당신은 문제 (들) 권한을 사용하기 시작 한 번 시작 말할?하시기 바랍니다 무엇인지하도록 할 수 있습니다 JavaScript API이므로 문제의 가능한 루트 영역에서 시작하는 것이 가장 좋습니다.

결과를 알려 주시면 문제를 해결해 드리겠습니다.

+0

크롬을 사용하면 X- 프레임 옵션에 의한 표시가 금지되어 있기 때문에 콘솔에서이 오류 만 표시됩니다.> 문서 표시를 거부했습니다. – ria

+0

파이어 폭스 파이어 버그의 경우이 오류> 캐치되지 않은 예외가 표시됨 : 오류 : 의 속성이 Proxy.InstallTrigger 속성을 가져 오기위한 권한이 거부되었습니다 ...하지만이 오류를 조사한 일부 장소에서는 firebug 자체는 – ria

+0

@ria입니다. iFrame이 올바르게 표시되지 않기 때문에 페이지가로드 될 때 Chrome 오류 및 빈 캔버스가 표시되므로 HttpRequest 헤더와 관련이있을 수 있습니다. 이러한 게시물은 다음과 같습니다. http://stackoverflow.com/a/6767901/730133, http://stackoverflow.com/questions/6666423/overcoming-display-forbidden-by-x-frame-options/6767901#6767901 –

관련 문제