Monday, May 9, 2016

Could not create a SecurityToken. A token was not found in the token cache and no cookie was found in the context.

This suggests putting this...

void Application_OnError()
{
   var ex = Context.Error;
   if (ex is SecurityTokenException)
   {
      Context.ClearError();
      if (FederatedAuthentication.SessionAuthenticationModule != null)
      {
         FederatedAuthentication.SessionAuthenticationModule.SignOut();
      }
      Response.Redirect("~/");
   }
}

 
 

...in Global.asax.cs will solve this identity/claims problem and it worked for me.

No comments:

Post a Comment