title: Unable to cast object of type System.Security.Claims.ClaimsPrincipal to type Microsoft.IdentityModel.Claims.IClaimsPrincipal
body: <p>I am developing one MVC4 application which authenticate corp domain users using ADFS and i have written the code and i am getting the error like below, am i not getting claims ?</p>
  
  <p>System.InvalidCastException: Unable to cast object of type 'System.Security.Claims.ClaimsPrincipal' to type 'Microsoft.IdentityModel.Claims.IClaimsPrincipal'.</p>
  
  <pre><code>    public ActionResult Index()
      {
          try
          {
  
              IClaimsPrincipal principal = (IClaimsPrincipal)Thread.CurrentPrincipal;
              IClaimsIdentity identity = (IClaimsIdentity)principal.Identity;
              if (String.IsNullOrEmpty(identity.Claims[0].Value.Split('@')[0]))
              {
                  ViewData["Message"] = string.Format("You are email is :{0}", identity.Claims[0].Value.Split('@')[0]);
  
              }
              else
              {
                  ViewData["Message"] = "You are not getting any claims";
              }
          }
          catch (Exception ex)
          {
              ViewData["Message"] = "Something wrong.";
          }
          return View();
      }
  </code></pre>