Does anyone have a solution for this? In my webauth-handler.aspx I have the followingcode to try to force the signout, and it is hitting the code, but if I log back in with a different idafter logging out (but not closing the browser), I get the original claims. I'm using LiveID as my Auth Provider.
protected void Page_Load(object sender, EventArgs e)
{
HttpRequest req = HttpContext.Current.Request;
HttpResponse res = HttpContext.Current.Response;
// Extract the 'action' parameter from the request, if any.
string action = req["action"];
/*
If action is 'logout', clear the login cookie and redirect
to the logout page.
If action is 'clearcookie', clear the login cookie and
return a GIF as response to signify success.
By default, try to process a login. If login was
successful, cache the user token in a cookie and redirect
to the site's main page. If login failed, clear the cookie
and redirect to the main page.
*/
if (action == "logout")
{
FederatedAuthentication.SignOut(true);
new SessionAuthenticationModule().SignOut(true);
HttpCookie loginCookie = new HttpCookie(LoginCookie) {Expires = ExpireCookie};
res.Cookies.Add(loginCookie);
res.Redirect(LogoutPage);
res.End();
}
else if (action == "clearcookie")
{
FederatedAuthentication.SignOut(true);
new SessionAuthenticationModule().SignOut(true);
HttpCookie loginCookie = new HttpCookie(LoginCookie) { Expires = ExpireCookie };
res.Cookies.Add(loginCookie);
string type;
byte[] content;
Wll.GetClearCookieResponse(out type, out content);
res.ContentType = type;
res.OutputStream.Write(content, 0, content.Length);
res.End();
}
else
{
WindowsLiveLogin.User user = Wll.ProcessLogin(req.Form);
HttpCookie loginCookie = new HttpCookie(LoginCookie);
if (user != null)
{
if (!string.IsNullOrEmpty(user.Context))
LoginPage = user.Context;
loginCookie.Value = user.Token;
if (user.UsePersistentCookie)
{
loginCookie.Expires = PersistCookie;
}
string realm = Request.Url.ToString().ToLower();
string issuer = ConfigurationManager.AppSettings.Get("AcsIssuer");
WSFederationAuthenticationModule authModule = new WSFederationAuthenticationModule
{
Realm = realm,
Issuer = issuer};
const string homeRealmSts = @"http://login.live.com";
Regex re = new Regex(@"(http[s]?://[\w-]*\.cloudapp\.net):[0-9]*");
if (re.IsMatch(Request.Url.ToString()))
authModule.Reply = re.Replace(Request.Url.ToString(), "$1");
else
authModule.Reply = Request.Url.ToString();
String uniqueId = Guid.NewGuid().ToString();
SignInRequestMessage signInMsg = authModule.CreateSignInRequest(uniqueId, authModule.Realm, false);
if (!String.IsNullOrEmpty(homeRealmSts))
{
signInMsg.Parameters.Add("whr", homeRealmSts);
}
Response.Redirect(signInMsg.RequestUrl);
}
else
{
loginCookie.Expires = ExpireCookie;
}
res.Cookies.Add(loginCookie);
res.Redirect(LoginPage);
res.End();
}