title: SignOut of claims authentication
body: <p>I have successfully implemented claims authentication in to my project.</p>
  
  <p>As shown here:</p>
  
  <pre><code> var userCredentials = new[] {
                  new Claim("UserId", userProfile.UserId.ToString()),
                  new Claim("Username", userProfile.UserName)};
  
          var id = new ClaimsIdentity(userCredentials, "Forms");
  
          var cp = new ClaimsPrincipal(id);
          var token = new SessionSecurityToken(cp);
  
          var sam = FederatedAuthentication.SessionAuthenticationModule;
          sam.WriteSessionTokenToCookie(token);
  </code></pre>
  
  <p>Which is working correctly, the issue I'm trying to resolve is signing that user out, I have the following class which is called when the user presses Sign Out</p>
  
  <pre><code> public static void SignOut()
   {
       FormsAuthentication.SignOut();
   }
  </code></pre>
  
  <p>Which didn't seem to log the user out, so I went on a google search and tried the following: </p>
  
  <pre><code>FederatedAuthentication.SessionAuthenticationModule.SignOut();
  FederatedAuthentication.SessionAuthenticationModule.DeleteSessionTokenCookie();
  </code></pre>
  
  <p>Neither of them work either? what could I possibly doing wrong? </p>
  
  <p>This is my config: </p>
  
  <pre><code> &lt;configSections&gt;
       &lt;section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /&gt;
       &lt;section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /&gt;
  &lt;/configSections&gt;
  
  &lt;system.web&gt;
      &lt;authentication mode="Forms"&gt;
         &lt;forms loginUrl="/User/Login" timeout="2880" /&gt;
      &lt;/authentication&gt;
      &lt;compilation debug="true" targetFramework="4.5" /&gt;
      &lt;httpRuntime targetFramework="4.5" maxRequestLength="1048576" /&gt;
  &lt;/system.web&gt;
  
   &lt;modules&gt;
    &lt;add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
  &lt;/modules&gt;
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p><em>Update</em></p>
  
  <p>I've just tried the following:</p>
  
  <pre><code>FormsAuthentication.SignOut();
  Session.Abandon();
  
  // clear authentication cookie
  HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, "");
  cookie1.Expires = DateTime.Now.AddYears(-1);
  Response.Cookies.Add(cookie1);
  
  // clear session cookie (not necessary for your current problem but i would recommend you do it anyway)
  HttpCookie cookie2 = new HttpCookie("ASP.NET_SessionId", "");
  cookie2.Expires = DateTime.Now.AddYears(-1);
  Response.Cookies.Add(cookie2);
  </code></pre>
  
  <p>And redirected to the FAQ page but still I can see links in the navigation which should only been shown if the user is Authenticated.</p>