I have configured an intranet using Claims based authentication and an extended internet site using forms based authentication in SP 2010
All is set up and working except logging out...
I have a loginstatus control which I have placed a linkbutton inside the loggedin template. When I click the button to log out, I have used:
Session.Abandon();
Response.Cookies.Clear();
FormsAuthentication.SignOut();
And a custo开发者_运维百科m redirect. ~However when I get redirected back to my home page the system still says that Im logged in and I navigate around the site. How else do I force a logout?
See this post by Sanjay Bhagia
loginStatus.LoggingOut += new LoginCancelEventHandler(loginStatus_LoggingOut);
and in logout event, i used this code to logout the user.
FederatedAuthentication.SessionAuthenticationModule.SignOut();
//WSFederationAuthenticationModule.FederatedSignOut();
WSFederationAuthenticationModule authModule = FederatedAuthentication.WSFederationAuthenticationModule;
SPUtility.Redirect(WSFederationAuthenticationModule.GetFederationPassiveSignOutUrl(authModule.Issuer, authModule.Realm, null), SPRedirectFlags.Default, HttpContext.Current);
as, with Claims, user is not authenticated with FormsAuthentication anymore rather with Federated Authentication, so we need to sign out this user from Federation. This piece of code worked for me!
精彩评论