title: Federated Authentication and "Error occurred during a cryptographic operation"
body: <p>I got this exception when I try get my home page on ASP.NET MVC application. </p>
  
  <blockquote>
    <p>[CryptographicException: Error occurred during a cryptographic
    operation.]<br>
    System.Web.Security.Cryptography.HomogenizingCryptoServiceWrapper.HomogenizeErrors(Func`2
    func, Byte[] input) +246<br>
    System.IdentityModel.Services.MachineKeyTransform.Decode(Byte[]
    encoded) +191<br>
    System.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[]
    cookie, Boolean outbound) +173<br>
    System.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader
    reader, SecurityTokenResolver tokenResolver) +756<br>
    System.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[]
    token, SecurityTokenResolver tokenResolver) +100<br>
    System.IdentityModel.Services.SessionAuthenticationModule.ReadSessionTokenFromCookie(Byte[]
    sessionCookie) +1164<br>
    System.IdentityModel.Services.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken&amp;
    sessionToken) +287<br>
    System.IdentityModel.Services.SessionAuthenticationModule.OnAuthenticateRequest(Object
    sender, EventArgs eventArgs) +231<br>
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    +80    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +165</p>
  </blockquote>
  
  <p>From what I understand something get wrong in the cookie for SessionAuthenticationModule. If you clear the cookies (as stated already here <a href="https://stackoverflow.com/questions/14119965/federated-authentication-on-azure">Federated Authentication on Azure</a>) it works. What I would like is to understand what is going on, how to catche the exceptions and fix the issue.</p>