views:

181

answers:

0

OK, so I'm working on an ASP.NET webapp with AJAX and the Windows Live ID SDK. I've successfully gotten it to authenticate via Live, however...

The Windows Live ID spec indicates that I have to look for request headers "login", "logout", and "clearcookie". The recommended code samples include a Response.Redirect, which doesn't seem to work when your page has extensive use of UpdatePanels:

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

Further, the clearcookie Action requires I write directly to the Response:

public WindowsLiveLogin wll = new WindowsLiveLogin(key1, key2);

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

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

As a result, the response doesn't recognize it and the Windows Live logout feature times out, whether doing it via my logout button (logout Action) or the Windows Live site's logout feature (clearcookie Action). How can this be accomplished with static UpdatePanels and other AJAX controls in the markup?

I used this in a former AJAX project. I settled for not having logout functionality, which of course can be bypassed by clearing one's cookies. Please tell me a more elegant way!