Ejemplo n.º 1
0
        protected void bt_desparear_Click(object sender, EventArgs e)
        {
            string     cookieName = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie = Context.Request.Cookies[cookieName];

            if (authCookie == null)
            {
                return;
            }
            FormsAuthenticationTicket authTicket = null;

            try
            {
                authTicket = FormsAuthentication.Decrypt(authCookie.Value);
            }
            catch
            {
                return;
            }
            if (authTicket == null)
            {
                return;
            }
            string[]         roles     = authTicket.UserData.Split(new char[] { '|' });
            FormsIdentity    id        = new FormsIdentity(authTicket);
            GenericPrincipal principal = new GenericPrincipal(id, roles);


            //LatchSDK.LatchResponse unpairResponse = instanciaLatch.Unpair(HttpContext.Current.User.Identity.Name);

            LatchSDK.LatchResponse unpairResponse = instanciaLatch.Unpair(ConfigurationManager.AppSettings["latchAccountId"]);
            if (unpairResponse.Error == null)
            {
                lb_error_account_id.Text = "La aplicación se ha despareado.";
            }
            else
            {
                lb_error_account_id.Text = "Se ha producido un error en el proceso de despareado.";
            }
        }