Posted By: SlackmasterK | Oct 7th @ 5:15 PM
page 1 of 1
Comments: 3 | Views: 515
SlackmasterK
SlackmasterK
I write my OWN blogging engines

I've integrated the Windows Live SDK into a prototype for my blog rewrite. Unfortunately, it's not handling the Logout calls correctly. According to the SDK Documentation, I should be able to accomplish a Logout with the following code:

HttpCookie loginCookie = new HttpCookie("webauthtoken");
loginCookie.Expires = DateTime.Now.AddYears(-10);
Response.Cookies.Add("webauthtoken");
Response.Redirect("default.aspx");
Response.End();

Unfortunately, Response.Redirect and Response.End don't work when your ASP.NET application also happens to be running AJAX. As a result, the Windows Live logout page reports it was unable to log out of the website. I have verified this code is being run.

Further, the "clearcookie" function call has similar problems, as it wants to return a GIF for some odd reason:

HttpCookie loginCookie = new HttpCookie("webauthtoken");
loginCookie.Expires = DateTime.Now.AddYears(-10);
Response.Cookies.Add("webauthtoken");

string type;
byte[] content;
wll.GetClearCookieResponse(out type, out content);
Response.ContentType = type;
Response.OutputStream.Write(content, 0, content.Length);

Response.End();

How can I accomplish this correctly without sacrificing the AJAX functionality?

PerfectPhase
PerfectPhase
"This is not war, this is pest control!" - Dalek to Cyberman

"Unfortunately, Response.Redirect and Response.End don't work when your ASP.NET application also happens to be running AJAX. As a result, the Windows Live logout page reports it was unable to log out of the website. I have verified this code is being run."

Do you mean using the MS-AJAX framework, or that your Page is being processed in the context of a partial postback, such as from an Update panel via XHR?
Duncanma
Duncanma
Just Coding for Fun...
Login/Logout actions for Live ID shouldn't happen using AJAX, you should make them full page requests so that you do the proper redirection.

We did login/logout using AJAX on on10.net, but once we knew we would be switching to Live ID, we moved to regular page requests / postbacks for any of the authentication links.
page 1 of 1
Comments: 3 | Views: 515