static void Main(string[] args)
        {
            try
            {
                RequestSecurityTokenConfiguration rstConfig = RequestSecurityTokenConfiguration.Get();
                //Send request to issue security token from Samples.STS
                var token = IdentifyStsCertificateEndpointHandler.GetSecurityToken(rstConfig);

                //Use the issued token to execute the server on Samples.Service
                var service = IdentifyStsServiceCommon.GetClaimAppService <IService>(token, rstConfig.AppliesTo);
                var claims  = service.GetClaims();

                Console.WriteLine("Ping to service successfully.");
                Console.WriteLine("There are '{0}' claims retrieved.", claims.Length);
                if (claims.Length > 0)
                {
                    int i = 1;
                    foreach (var claim in claims)
                    {
                        Console.WriteLine("Claim '{0}': '{1}' - '{2}'", i, claim.ClaimType, claim.Value);
                        i++;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception thrown: " + ex);
            }
            Console.ReadLine();
        }
        protected void Btn_Ping_Click(object sender, EventArgs e)
        {
            var bootstrapToken = HttpContext.Current.Session["boostraptoken"] as SecurityToken;

            if (bootstrapToken == null)
            {
                throw new Exception("Cannot get bootstrap context");
            }

            RequestSecurityTokenConfiguration rstConfig = RequestSecurityTokenConfiguration.Get();

            //Send request to issue security token from Samples.STS
            var token = IdentifyStsCertificateEndpointHandler.GetSecurityToken(rstConfig, bootstrapToken);

            //Use the issued token to execute the server on Samples.Service
            var service = IdentifyStsServiceCommon.GetClaimAppService <IService>(token, rstConfig.AppliesTo);
            var claims  = service.GetClaims();
            var actors  = service.GetActorClaims();

            var claimappserviceresonse = new StringBuilder();

            claimappserviceresonse.AppendLine("<table>");
            claimappserviceresonse.AppendFormat(string.Format("<tr><td>There are '{0}' claims on security token.</td></tr>", claims.Length));
            claimappserviceresonse.AppendLine();
            if (claims.Length > 0)
            {
                int i = 1;
                foreach (var claim in claims)
                {
                    claimappserviceresonse.AppendFormat("<tr><td>Claim '{0}': '{1}' - '{2}'</td></tr>", i, claim.ClaimType, claim.Value);
                    claimappserviceresonse.AppendLine();
                    i++;
                }
            }
            claimappserviceresonse.AppendLine("</table>");

            claimappserviceresonse.AppendLine("<table>");
            claimappserviceresonse.AppendFormat(string.Format("<tr><td>There are '{0}' claims on security token's actor.</td></tr>", actors.Length));
            claimappserviceresonse.AppendLine();
            if (actors.Length > 0)
            {
                int i = 1;
                foreach (var claim in actors)
                {
                    claimappserviceresonse.AppendFormat("<tr><td>Claim '{0}': '{1}' - '{2}'</td></tr>", i, claim.ClaimType, claim.Value);
                    claimappserviceresonse.AppendLine();
                    i++;
                }
            }
            claimappserviceresonse.AppendLine("</table>");

            ClaimAppServiceResponse.InnerHtml =
                string.Format("<p>Successfully ping to Identify service </p><br/><p>{0}</p>", claimappserviceresonse);
        }