Q:

Facebook C# Iframe Authorization

I have an IFrame Facebook application that uses Facebook C# SDK. I also use jquery and load some page components asynchronously. For example, I call the following javascript from main page(at this point user is authenticated)
$.ajax({            
    type: "POST",
    url: "Ajax/GetMyBalance.aspx",        
    datatype: 'text',
    success: function (html) {
        $('#balance_div').html(html);
    }
    });

The problem is that in GetMyBalance.aspx:PageLoad the user is not authenticated. I tried adding 
 FacebookApp app = new FacebookApp();
 CanvasAuthorizer auth = new CanvasAuthorizer(app);
 if (!auth.IsAuthorized()) // always true when page is loaded first time
 {
    var url = auth.GetLoginUrl(new HttpRequestWrapper(Request));
    var content = CanvasUrlBuilder.GetCanvasRedirectHtml(url);
    Response.ContentType = "text/html";
    Response.Write(content);
    Response.End();
 }

to GetMyBalance.aspx:PageLoad ; it did authenticate the user, but it also redirected browser to Myapp/Ajax/GetMyBalance.aspx which might make sense, but it's absolutely not what I wanted. How can I authenticate user in this case ? 
Thanks for your answers.

A:

You can do it with no cookies.  Set cookieSupport = false in the SDK settings and initialize the Javascript client library with cookie=false.  Then get the auth token using the Javascript client library before you post, pass the auth token up to the server, and use it to instantiate your FacebookApp instance.
        FB.getLoginStatus(function (response) {
          if (response.session) {
            $('#AuthToken').val(response.session.access_token);
            $('form').ajaxSubmit(options);
            return false;
          } else {
            // not logged in, prompt them to retry
            return false;
          }
        }, true);

