title: facebook asp.net page redirects - can't do response redirect
body: <p>I need some guidance please. I created a <code>default.aspx</code> page that displays the user's first name but also contains a button that redirect to a <code>result.aspx</code> page <code>onclick</code>. It seems  that every time I click on the button I get an infinite loop error. What should I do on <code>page_load</code> of <code>result.aspx</code> to get this work?</p>
  
  <p>Here's my code from <code>default.aspx</code>:</p>
  
  <pre><code>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 + "&amp;redirect_uri=http://www.mydomain.com&amp;scope=email");
          name.Text = "no connected";
      }
  
  
  }
  public bool IsConnected()
  {
      if (cookie == null)
          cookie = FacebookCookie.GetCookie(appId, appSecret);
      return cookie != null &amp;&amp; cookie.UserId != 0 &amp;&amp; !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");
  }
  </code></pre>