I have a custom login in Sharepoint 2010 using claims-based authentication. User authentication works just fine but my custom sign out method doesn't. I have tried several solutions but my authentication cookie (federation) is still there. Why?
This will not work:
FormsAuthentication.SignOut();
Not this:
FederatedAuthentication.SessionAuthenticationModule.SignOut();
FederatedAuthentication.SessionAuthenticationModule.DeleteSessionTokenCookie();
Nor will this:
var authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
if (authCookie != null)
{
HttpCookie cookie = new HttpCookie(authCookie.Name);
cookie.Expires = DateTime.Now.AddDays(-1d);
cookie.Domain = domain;
Response.Cookies.Add(cookie);
}
How do I delete my FedAuth cookie? My cookie is not persistent. Still the only way to remove my auth cookie is deleting it manually in my browser or closing it down.