저는 페이스 북 애플리케이션 (ASP.NET C# 및 Nathan Totten의 Facebook C# SDK 사용)을 개발 중이며 확장 된 권한에 액세스하려고합니다. 페이스 북의 기존 응용 프로그램과 함께 localhost에서 시도했지만 모두 작동합니다. 하지만 페이스 북에서 직접 사용하려고하면 빈 페이지 (나는 여전히 페이스 북에 연결되어 있음)를 얻습니다.C#의 확장 된 사용 권한
페이지/영문 : 내를 Page_Load에서
protected void btn_ask_question_Click(object sender, EventArgs e)
{
if (ControllerAccess.testUserConnected())
{
if (txt_ask_question.InnerText != "")
{
Dictionary<string, object> action = new Dictionary<string,object>();
action.Add("action", "askQuestion");
action.Add("message", txt_ask_question.InnerText);
action.Add("idTheme", ddl_choose_question_category.SelectedValue);
HttpContext.Current.Session["ActionToDo"] = action;
String s = Controller.GetExtendedPermission2(this, ControllerAccess.getScopeByAction("askQuestion"));
try{
Response.Redirect(s, false);
} catch(Exception ex)
{
}
}
}
}
() : Control.cs에서
if (HttpContext.Current.Session["ActionToDo"] != null)
{
Dictionary<string, object> action = HttpContext.Current.Session["ActionToDo"] as Dictionary<string, object>;
String s = action["action"].ToString();
switch (s)
{
case "askQuestion":
Guid idTheme;
Boolean themeExists = Guid.TryParse(action["idTheme"].ToString(), out idTheme);
if(themeExists)
{
askQuestion(action["message"].ToString(), idTheme);
lbl_errors.Text = "Votre question a bien été posée";
}
break;
default:
break;
}
HttpContext.Current.Session["ActionToDo"] = null;
}
: 여기
내 코드입니다public static string GetCustomOAuthDialogParameters(string AppID, string RedirectURI, string Scope, string State)
{
string CustomParameters = "?client_id=" + AppID + "&redirect_uri=" + RedirectURI + "&scope=" + Scope + "&state=" + State;
return CustomParameters;
}
public static void GetExtendedPermission(Page page, String scope)
{
ecritureFichier("GetExtendedPermission");
Label lbl_errors = page.Form.FindControl("lbl_errors") as Label;
string OAuthDialogAbsoluteURL = "";
try
{
string OAuthDialogURL = "https://www.facebook.com/dialog/oauth";
string PageLocation = GetCurrentPageFacebookPublishedPath(page.Request); //The redirect page (eg: https://apps.facebook.com/democsharpsdk/TestsExtendedPermission.aspx)
string UniqueReferenceCode = Guid.NewGuid().ToString();
OAuthDialogAbsoluteURL = OAuthDialogURL + GetCustomOAuthDialogParameters(AppID, PageLocation, scope, UniqueReferenceCode);
page.Response.Redirect(OAuthDialogAbsoluteURL, false);
}
catch (Exception exp)
{
lbl_errors.Text += "Erreur Catchée via ASP.NET : " + exp.Message;
}
}
이 l을 사용하면 빈 페이지가 나타납니다. ine : page.Response.Redirect (OAuthDialogAbsoluteURL, false);
는 그러나 나는 내 모든 단계를 기록하고 내 OAuthDialogAbsoluteURL 올바른 것입니다 : 내가 수동으로 ADRESS 표시 줄에 입력하면 모든 것이 제대로 작동
.
로컬 버전과 게시 된 버전의 차이점이나 리디렉션이 작동하지 않는 이유는 무엇입니까? 어쩌면 facebook이 일부 요청을 차단할 수 있습니까?
감사합니다.
그래서 내가 주소를 보여줍니다. 나는 그것이 정확하고 facebook developper 페이지가 아마도 그것이 좋은 방법이라는 것을 확인한다고 생각합니다. 그래서 나는 내가 뭔가 잘못했는지 알고 싶었다. :). 캐치 메서드에서 로그 메시지가 있지만 아무것도 기록되지 않습니다. 그래서 캐치 ..에 이동하지 않습니다. : / – algelos