Login Redirects / Response.Write and UpdatePanels

Mar 26, 2010 at 5:54 AM

Hello.  I'm very close to ajaxing my whole site, but I've run into an question.  So basically, it seems I can't use Response.Write while processing an AJAX postback (at least with the UpdatePanel).  To me, this becomes an issue...what I means is...There are a couple times in my code where I run JS similar to the Login() functions of FDT.  I clear and write directly to the Response some JS to redirect the top frame of the page back to facebook.  I really want to validate my facebook session on postbacks (this is where i was redirecting users), but I'm not sure how to handle redirection since directly writting to the response seems to throw errors.  I may have not tried all variations of this implementation, but I'm kinda stuck.  

It seems that if i put the JS redirection in a StartupScript, the user would see 2 refreshes when the code is run.  Also...would the toolkit crash on a redirection due to Invalid Cached session if your using UpdatePanels...which would be checked possibly during a postback IFrameCanvasSession.OnInit/RequireLogin?

I really hope someone here can answer my question...because I really wanna AJAX this site.

Thanks,

stringa

Mar 26, 2010 at 8:33 AM
Edited Mar 26, 2010 at 8:37 AM

I guess I'm questioning the implementation.  I am not able to test till tomorrow, so i'm looking for idea's.  It seems that I can authenticate, and let ftd use the cachesession info.  I've also noticed the function : 

FB.init("<YOUR-API-KEY>", "<YOUR-CROSS-DOMAIN-CHANNEL-URL>", {"reloadIfSessionStateChanged":true});

which would always keep my session valid?

 for my canvas iframe app?

 

So here is my worst case senario.  For some reason my app crashes during an Asynchronous postback.  It hits a Global.asax file.  There I modify the response with Response.Clear() , Response.Write(JS_Redirection to FB Login page), and Response.End().  The question is, will it succeed and not crash on client and server?  or do I have to write this as a startup script?  will a startup script work from the Global.asax?