Exemplo n.º 1
0
        /// <summary>
        /// update the UI
        /// </summary>
        private void UpdateControls()
        {
            // hosts list
            if (_enterpriseSession != null && _enterpriseSession.AuthenticationErrorCode == EnterpriseAuthenticationErrorCode.NONE && (RemoteSession == null || RemoteSession.State == RemoteSessionState.Disconnecting || RemoteSession.State == RemoteSessionState.Disconnected))
            {
                toolbar.Style["visibility"] = "hidden";
                toolbar.Style["display"]    = "none";
                hosts.Visible        = true;
                newHost.Visible      = _enterpriseSession.IsAdmin;
                hostsList.DataSource = _enterpriseClient.GetSessionHosts(_enterpriseSession.SessionID);
                hostsList.DataBind();
            }
            // active remote session
            else if (RemoteSession != null && (RemoteSession.State == RemoteSessionState.Connecting || RemoteSession.State == RemoteSessionState.Connected))
            {
                toolbar.Style["visibility"] = "visible";
                toolbar.Style["display"]    = "block";
                serverInfo.Value            = (!string.IsNullOrEmpty(RemoteSession.ServerName) ? RemoteSession.ServerName : RemoteSession.ServerAddress);
                stat.Value          = RemoteSession.StatMode ? "Hide Stat" : "Show Stat";
                stat.Disabled       = false;
                debug.Value         = RemoteSession.DebugMode ? "Hide Debug" : "Show Debug";
                debug.Disabled      = false;
                browser.Value       = RemoteSession.CompatibilityMode ? "HTML5" : "HTML4";
                browser.Disabled    = false;
                scale.Value         = RemoteSession.ScaleDisplay ? "Unscale" : "Scale";
                scale.Disabled      = false;
                keyboard.Disabled   = false;
                clipboard.Disabled  = !RemoteSession.AllowRemoteClipboard;
                files.Disabled      = RemoteSession.ServerAddress.ToLower() != "localhost" && RemoteSession.ServerAddress != "127.0.0.1" && RemoteSession.ServerAddress != "[::1]" && RemoteSession.ServerAddress != Request.Url.Host && string.IsNullOrEmpty(RemoteSession.UserDomain);
                cad.Disabled        = false;
                mrc.Disabled        = false;
                share.Disabled      = !RemoteSession.AllowSessionSharing || !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                disconnect.Disabled = false;
            }
            // login screen
            else
            {
                login.Visible = true;

                // MFA
                if (_mfaAuthClient.GetState())
                {
                    mfaDiv.Visible        = true;
                    mfaProvider.InnerText = _mfaAuthClient.GetPromptLabel();
                    mfaProvider.HRef      = _mfaAuthClient.GetProviderURL();
                }

                // enterprise mode
                if (_enterpriseClient.GetState())
                {
                    domainServerDiv.Visible = false;
                }
                // standard mode
                else
                {
                    connect.Attributes["onclick"] = "showToolbar();";
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// update the UI
        /// </summary>
        private void UpdateControls()
        {
            // remote session toolbar
            if (RemoteSession != null && (RemoteSession.State == RemoteSessionState.Connecting || RemoteSession.State == RemoteSessionState.Connected))
            {
                toolbarToggle.Style["visibility"] = "visible";
                toolbarToggle.Style["display"]    = "block";
                serverInfo.Value    = !string.IsNullOrEmpty(RemoteSession.VMGuid) ? RemoteSession.VMGuid : (!string.IsNullOrEmpty(RemoteSession.HostName) ? RemoteSession.HostName : RemoteSession.ServerAddress);
                userInfo.Value      = !string.IsNullOrEmpty(RemoteSession.VMGuid) || RemoteSession.SecurityProtocol == SecurityProtocolEnum.rdp ? string.Empty : RemoteSession.UserName;
                userInfo.Visible    = !string.IsNullOrEmpty(userInfo.Value);
                stat.Value          = RemoteSession.StatMode ? "Hide Stat" : "Show Stat";
                stat.Disabled       = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                debug.Value         = RemoteSession.DebugMode ? "Hide Debug" : "Show Debug";
                debug.Disabled      = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                browser.Value       = RemoteSession.CompatibilityMode ? "HTML5" : "HTML4";
                browser.Disabled    = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                scale.Value         = RemoteSession.ScaleDisplay ? "Unscale" : "Scale";
                scale.Disabled      = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH;
                keyboard.Disabled   = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                clipboard.Disabled  = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH || !RemoteSession.AllowRemoteClipboard || (!string.IsNullOrEmpty(RemoteSession.VMGuid) && !RemoteSession.VMEnhancedMode);
                files.Disabled      = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH || !RemoteSession.AllowFileTransfer || (RemoteSession.ServerAddress.ToLower() != "localhost" && RemoteSession.ServerAddress != "127.0.0.1" && RemoteSession.ServerAddress != "[::1]" && RemoteSession.ServerAddress != Request.Url.Host && string.IsNullOrEmpty(RemoteSession.UserDomain)) || !string.IsNullOrEmpty(RemoteSession.VMGuid);
                cad.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH;
                mrc.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH;
                vswipe.Disabled     = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostTypeEnum.SSH;
                share.Disabled      = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || !RemoteSession.AllowSessionSharing;
                disconnect.Disabled = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
            }
            // hosts list
            else if (_enterpriseSession != null && _enterpriseSession.AuthenticationErrorCode == EnterpriseAuthenticationErrorCode.NONE)
            {
                hosts.Visible              = true;
                enterpriseUserInfo.Value   = _enterpriseSession.UserName;
                enterpriseUserInfo.Visible = !string.IsNullOrEmpty(enterpriseUserInfo.Value);
                newRDPHost.Visible         = _enterpriseSession.IsAdmin;
                newSSHHost.Visible         = _enterpriseSession.IsAdmin;
                hostsList.DataSource       = _enterpriseClient.GetSessionHosts(_enterpriseSession.SessionID);
                hostsList.DataBind();
            }
            // login screen
            else
            {
                login.Visible = true;

                // MFA
                if (_mfaAuthClient.GetState())
                {
                    mfaDiv.Visible        = true;
                    mfaProvider.InnerText = _mfaAuthClient.GetPromptLabel();
                    mfaProvider.HRef      = _mfaAuthClient.GetProviderURL();
                }

                // enterprise mode
                if (_enterpriseClient.GetState())
                {
                    hostConnectDiv.Visible = false;
                }
                // standard mode
                else
                {
                    connect.Attributes["onclick"] = "initDisplay();";
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// update the UI
        /// </summary>
        private void UpdateControls()
        {
            // remote session toolbar
            if (RemoteSession != null && (RemoteSession.State == RemoteSessionState.Connecting || RemoteSession.State == RemoteSessionState.Connected))
            {
                if (_toolbarEnabled)
                {
                    // interacting with the remote session is available to guests with control access, but only the remote session owner should have control on the remote session itself
                    var controlEnabled = Session.SessionID.Equals(RemoteSession.OwnerSessionID) || (Session[HttpSessionStateVariables.GuestInfo.ToString()] != null && ((GuestInfo)Session[HttpSessionStateVariables.GuestInfo.ToString()]).Control);

                    toolbar.Visible       = true;
                    toolbarToggle.Visible = true;
                    serverInfo.Value      = !string.IsNullOrEmpty(RemoteSession.VMGuid) ? RemoteSession.VMGuid : (!string.IsNullOrEmpty(RemoteSession.HostName) ? RemoteSession.HostName : RemoteSession.ServerAddress);
                    userInfo.Value        = !string.IsNullOrEmpty(RemoteSession.VMGuid) || RemoteSession.SecurityProtocol == SecurityProtocol.rdp ? string.Empty : (string.IsNullOrEmpty(RemoteSession.UserDomain) ? RemoteSession.UserName : string.Format("{0}\\{1}", RemoteSession.UserDomain, RemoteSession.UserName));
                    userInfo.Visible      = !string.IsNullOrEmpty(userInfo.Value);
                    scale.Value           = RemoteSession.BrowserResize == BrowserResize.Scale ? "Scale ON" : "Scale OFF";
                    scale.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH;
                    reconnect.Value       = RemoteSession.BrowserResize == BrowserResize.Reconnect ? "Reconnect ON" : "Reconnect OFF";
                    reconnect.Disabled    = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH;
                    keyboard.Disabled     = !controlEnabled || (!string.IsNullOrEmpty(RemoteSession.VMGuid) && !RemoteSession.VMEnhancedMode);
                    osk.Disabled          = !controlEnabled || RemoteSession.HostType == HostType.SSH;
                    clipboard.Disabled    = !controlEnabled || RemoteSession.HostType == HostType.SSH || !RemoteSession.AllowRemoteClipboard || (!string.IsNullOrEmpty(RemoteSession.VMGuid) && !RemoteSession.VMEnhancedMode);
                    files.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH || !RemoteSession.AllowFileTransfer || (RemoteSession.ServerAddress.ToLower() != "localhost" && RemoteSession.ServerAddress != "127.0.0.1" && RemoteSession.ServerAddress != "[::1]" && RemoteSession.ServerAddress != Request.Url.Host && string.IsNullOrEmpty(RemoteSession.UserDomain)) || !string.IsNullOrEmpty(RemoteSession.VMGuid);
                    cad.Disabled          = !controlEnabled || RemoteSession.HostType == HostType.SSH;
                    mrc.Disabled          = !controlEnabled || RemoteSession.HostType == HostType.SSH;
                    vswipe.Disabled       = !controlEnabled || RemoteSession.HostType == HostType.SSH;
                    share.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || !RemoteSession.AllowSessionSharing;
                    disconnect.Disabled   = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                    imageQuality.Disabled = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH;
                }
            }
            // hosts list
            else if (_enterpriseSession != null && _enterpriseSession.AuthenticationErrorCode == EnterpriseAuthenticationErrorCode.NONE)
            {
                hosts.Visible              = true;
                enterpriseUserInfo.Value   = string.IsNullOrEmpty(_enterpriseSession.Domain) ? _enterpriseSession.UserName : string.Format("{0}\\{1}", _enterpriseSession.Domain, _enterpriseSession.UserName);
                enterpriseUserInfo.Visible = !string.IsNullOrEmpty(enterpriseUserInfo.Value);
                newRDPHost.Visible         = _enterpriseSession.IsAdmin;
                newSSHHost.Visible         = _enterpriseSession.IsAdmin;
                hostsList.DataSource       = _enterpriseClient.GetSessionHosts(_enterpriseSession.SessionID);
                hostsList.DataBind();
            }
            // login screen
            else
            {
                // connection params are sent when the login form is submitted, either through http post (the default form method) or http get (querystring)
                login.Visible = _loginEnabled;

                // MFA
                if (_mfaAuthClient.GetState())
                {
                    mfaDiv.Visible        = true;
                    mfaProvider.InnerText = _mfaAuthClient.GetPromptLabel();
                    mfaProvider.HRef      = _mfaAuthClient.GetProviderURL();
                }

                // enterprise mode
                if (_enterpriseClient.GetMode() == EnterpriseMode.Domain || _localAdmin)
                {
                    hostConnectDiv.Visible = false;
                    adminDiv.Visible       = _localAdmin;
                    if (adminDiv.Visible)
                    {
                        adminText.InnerText = "Home";
                        adminUrl.HRef       = "~/";
                    }
                }
                // standard mode
                else
                {
                    connect.Attributes["onclick"] = "initDisplay();";
                    adminDiv.Visible = _enterpriseClient.GetMode() == EnterpriseMode.Local;
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// update the UI
        /// </summary>
        private void UpdateControls()
        {
            // remote session toolbar
            if (RemoteSession != null && (RemoteSession.State == RemoteSessionState.Connecting || RemoteSession.State == RemoteSessionState.Connected))
            {
                if (_toolbarEnabled)
                {
                    toolbar.Visible       = true;
                    toolbarToggle.Visible = true;
                    serverInfo.Value      = !string.IsNullOrEmpty(RemoteSession.VMGuid) ? RemoteSession.VMGuid : (!string.IsNullOrEmpty(RemoteSession.HostName) ? RemoteSession.HostName : RemoteSession.ServerAddress);
                    userInfo.Value        = !string.IsNullOrEmpty(RemoteSession.VMGuid) || RemoteSession.SecurityProtocol == SecurityProtocol.rdp ? string.Empty : RemoteSession.UserName;
                    userInfo.Visible      = !string.IsNullOrEmpty(userInfo.Value);
                    scale.Value           = RemoteSession.BrowserResize == BrowserResize.Scale ? "Scale ON" : "Scale OFF";
                    scale.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH;
                    reconnect.Value       = RemoteSession.BrowserResize == BrowserResize.Reconnect ? "Reconnect ON" : "Reconnect OFF";
                    reconnect.Disabled    = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH;
                    keyboard.Disabled     = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                    clipboard.Disabled    = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH || !RemoteSession.AllowRemoteClipboard || (!string.IsNullOrEmpty(RemoteSession.VMGuid) && !RemoteSession.VMEnhancedMode);
                    files.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH || !RemoteSession.AllowFileTransfer || (RemoteSession.ServerAddress.ToLower() != "localhost" && RemoteSession.ServerAddress != "127.0.0.1" && RemoteSession.ServerAddress != "[::1]" && RemoteSession.ServerAddress != Request.Url.Host && string.IsNullOrEmpty(RemoteSession.UserDomain)) || !string.IsNullOrEmpty(RemoteSession.VMGuid);
                    cad.Disabled          = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH;
                    mrc.Disabled          = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH;
                    vswipe.Disabled       = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || RemoteSession.HostType == HostType.SSH;
                    share.Disabled        = !Session.SessionID.Equals(RemoteSession.OwnerSessionID) || !RemoteSession.AllowSessionSharing;
                    disconnect.Disabled   = !Session.SessionID.Equals(RemoteSession.OwnerSessionID);
                }
            }
            // hosts list
            else if (_enterpriseSession != null && _enterpriseSession.AuthenticationErrorCode == EnterpriseAuthenticationErrorCode.NONE)
            {
                hosts.Visible              = true;
                enterpriseUserInfo.Value   = _enterpriseSession.UserName;
                enterpriseUserInfo.Visible = !string.IsNullOrEmpty(enterpriseUserInfo.Value);
                newRDPHost.Visible         = _enterpriseSession.IsAdmin;
                newSSHHost.Visible         = _enterpriseSession.IsAdmin;
                hostsList.DataSource       = _enterpriseClient.GetSessionHosts(_enterpriseSession.SessionID);
                hostsList.DataBind();
            }
            // login screen
            else
            {
                // connection params are sent when the login form is submitted, either through http post (the default form method) or http get (querystring)
                login.Visible = _loginEnabled;

                // MFA
                if (_mfaAuthClient.GetState())
                {
                    mfaDiv.Visible        = true;
                    mfaProvider.InnerText = _mfaAuthClient.GetPromptLabel();
                    mfaProvider.HRef      = _mfaAuthClient.GetProviderURL();
                }

                // enterprise mode
                if (_enterpriseClient.GetState())
                {
                    hostConnectDiv.Visible = false;
                }
                // standard mode
                else
                {
                    connect.Attributes["onclick"] = "initDisplay();";
                }
            }
        }