Ejemplo n.º 1
0
        protected void LogoutButtonClick(
            object sender,
            EventArgs e)
        {
            var success = true;

            var disconnectionClient = new DisconnectionClient("https://server/myrtille/api/Disconnection/");

            success = disconnectionClient.DisconnectAll();

            // if the page have iframes on different gateways, call DisconnectAll for each of them
            //if (success)
            //{
            //    disconnectionClient = new DisconnectionClient("<another gateway, disconnection api url>");
            //    success = disconnectionClient.DisconnectAll();
            //}

            // etc.

            var script = string.Empty;

            if (success)
            {
                script = "alert('all the remote sessions were disconnected successfully');";
            }
            else
            {
                script = "alert('failed to disconnect all the remote sessions');";
            }
            script += "window.location.href = 'logout.aspx'";
            ClientScript.RegisterClientScriptBlock(GetType(), Guid.NewGuid().ToString(), script, true);
        }
Ejemplo n.º 2
0
        protected void DisconnectButtonClick(
            object sender,
            EventArgs e)
        {
            var gatewayUrl = GetIFrameGatewayUrl((sender as HtmlInputButton).Attributes["data-fid"]);

            if (!string.IsNullOrEmpty(gatewayUrl))
            {
                var connectionId = GetIFrameConnectionId((sender as HtmlInputButton).Attributes["data-fid"]);
                if (connectionId != Guid.Empty)
                {
                    string script;
                    var    disconnectionClient = new DisconnectionClient(string.Format("{0}/api/Disconnection/", gatewayUrl));
                    if (disconnectionClient.Disconnect(connectionId))
                    {
                        script = "alert('the remote session was disconnected successfully. Press OK to open a new connection');";
                    }
                    else
                    {
                        script = "alert('failed to disconnect the remote session');";
                    }
                    ClientScript.RegisterClientScriptBlock(GetType(), Guid.NewGuid().ToString(), script, true);
                }
            }
        }