How to access the claims attributes in .net applications (SharePoint or ASP.NET)

Check also Where is Microsoft.Identitymodel.Claims.dll

        public string text = "";
        protected void Page_Load(object sender, EventArgs e)
        {
           
            text += "<table>" + "<tr><th>ClaimType</th><th>ValueType</th><th>Value</th></tr>";
            foreach(var claim in ((Microsoft.IdentityModel.Claims.ClaimsIdentity)(System.Web.HttpContext.Current.User.Identity)).Claims)
            {
                text += "<tr><td>" + claim.ClaimType + "</td><td>" + claim.ValueType + "</td><td>" + claim.Value + "</td></tr>";
            }
            text+= "</table>";
            
        }

References: How to: Access Claims in an ASP.NET Page

manuel11g

Leave a Reply