IClaimsPrincipal claimsPrincipal = Page.User as IClaimsPrincipal; if (claimsPrincipal != null) { IClaimsIdentity claimsIdentity = (IClaimsIdentity)Thread.CurrentPrincipal.Identity; if (claimsIdentity != null) { foreach (Claim item in claimsIdentity.Claims) { } } }
how to get the claims of a different user? Let say as a admin i want to see the claims of other user by passing userID
ReplyDeleteSuppose you have a user as SPUser object convert that SPUser object into IClaimsPrincipal.
DeleteThat means replace the first line of my code from Page.User as IClaimsPrincipal to SPUser object as IClaimsPrincipal
NOTE : make sure that the object should not be null or wrongly type casted before you process otherwise it will throw error