何かガイダンスをお願いします。 default.aspx
ページを作成して、ユーザーの名を表示しますが、result.aspx
ページonclick
にリダイレクトするボタンも含まれています。ボタンをクリックするたびに無限ループエラーが発生するようです。この作品を入手するにはpage_load
のresult.aspx
で何をすればいいですか?ここでfacebook asp.netページリダイレクト - 応答がリダイレクトできません
はdefault.aspx
から私のコードです:
string appId = "xxxxxxxxxxxxxxxxxxx";
string appSecret = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
FacebookCookie cookie = null;
FacebookClient app = new FacebookClient();
FacebookOAuthClient oAuth = new FacebookOAuthClient();
// FacebookWebClient apps = new FacebookWebClient();
FacebookApp apps = new FacebookApp();
string myRedirect_uri = "http://www.mydomain.com";
protected void Page_Load(object sender, EventArgs e)
{
if(apps.Session != null)
//if (IsConnected())
{
display(apps.AccessToken);
}
else
{
Response.Redirect("https://www.facebook.com/dialog/oauth?client_id=" + appId + "&redirect_uri=http://www.mydomain.com&scope=email");
name.Text = "no connected";
}
}
public bool IsConnected()
{
if (cookie == null)
cookie = FacebookCookie.GetCookie(appId, appSecret);
return cookie != null && cookie.UserId != 0 && !string.IsNullOrEmpty(cookie.SessionKey);
}
protected void display(string token)
{
FacebookClient thisclient = new FacebookClient(token);
dynamic dname = thisclient.Get("me");
name.Text = dname.name;
imgProfile.ImageUrl = "http://graph.facebook.com/" + dname.id + "/picture?type=large";
}
protected void btn_Click(object sender, EventArgs e)
{
Response.Redirect("~/resutl.aspx");
}