From 59ffd649f3d5501d6a40622509b9e32dbdf10051 Mon Sep 17 00:00:00 2001 From: sme-schleupen Date: Thu, 26 Aug 2021 13:12:20 +0200 Subject: [PATCH 1/3] Added load balance info as URL-Parameter --- .../IRemoteSessionProcess.cs | 3 +- Myrtille.Services/RemoteSessionProcess.cs | 6 +- Myrtille.Web/Default.aspx | 5 + Myrtille.Web/Default.aspx.cs | 6 +- Myrtille.Web/Default.aspx.designer.cs | 111 ++++++++++-------- Myrtille.Web/SendInputs.aspx.cs | 3 +- .../src/Clients/RemoteSessionProcessClient.cs | 6 +- .../Handlers/RemoteSessionSocketHandler.cs | 3 +- Myrtille.Web/src/RemoteSession.cs | 5 +- 9 files changed, 88 insertions(+), 60 deletions(-) diff --git a/Myrtille.Services.Contracts/IRemoteSessionProcess.cs b/Myrtille.Services.Contracts/IRemoteSessionProcess.cs index 4eeae93..5c0889b 100644 --- a/Myrtille.Services.Contracts/IRemoteSessionProcess.cs +++ b/Myrtille.Services.Contracts/IRemoteSessionProcess.cs @@ -41,7 +41,8 @@ void StartProcess( int clientHeight, bool allowRemoteClipboard, bool allowPrintDownload, - bool allowAudioPlayback); + bool allowAudioPlayback, + string loadBalanceInfo); /// /// stop the host client process diff --git a/Myrtille.Services/RemoteSessionProcess.cs b/Myrtille.Services/RemoteSessionProcess.cs index 4da5f28..279929a 100644 --- a/Myrtille.Services/RemoteSessionProcess.cs +++ b/Myrtille.Services/RemoteSessionProcess.cs @@ -120,7 +120,8 @@ public void StartProcess( int clientHeight, bool allowRemoteClipboard, bool allowPrintDownload, - bool allowAudioPlayback) + bool allowAudioPlayback, + string loadBalanceInfo) { Trace.TraceInformation("Connecting remote session {0}, type {1}, security {2}, server (:port) {3}, vm {4}, domain {5}, user {6}, program {7}", remoteSessionId, @@ -353,7 +354,8 @@ public void StartProcess( (allowRemoteClipboard ? " +" : " -") + "clipboard" + // clipboard support (securityProtocol != SecurityProtocol.auto ? " /sec:" + securityProtocol.ToString() : string.Empty) + // security protocol (allowAudioPlayback ? " /sound" : string.Empty) + // sound support - " /audio-mode:" + (allowAudioPlayback ? "0" : "2"); // audio mode (0: redirect, 1: play on server, 2: do not play) + " /audio-mode:" + (allowAudioPlayback ? "0" : "2") + // audio mode (0: redirect, 1: play on server, 2: do not play) + (!string.IsNullOrEmpty(loadBalanceInfo) ? " /load-balance-info:\"" + loadBalanceInfo +"\"" : string.Empty); } #endregion diff --git a/Myrtille.Web/Default.aspx b/Myrtille.Web/Default.aspx index 807bac6..d3ee933 100644 --- a/Myrtille.Web/Default.aspx +++ b/Myrtille.Web/Default.aspx @@ -177,6 +177,11 @@ + +
+ + +
diff --git a/Myrtille.Web/Default.aspx.cs b/Myrtille.Web/Default.aspx.cs index 084ec86..aeaab9c 100644 --- a/Myrtille.Web/Default.aspx.cs +++ b/Myrtille.Web/Default.aspx.cs @@ -36,7 +36,7 @@ namespace Myrtille.Web { public partial class Default : Page { - private MFAAuthenticationClient _mfaAuthClient = new MFAAuthenticationClient(); + private MFAAuthenticationClient _mfaAuthClient = new MFAAuthenticationClient(); private EnterpriseClient _enterpriseClient = new EnterpriseClient(); private ConnectionClient _connectionClient = new ConnectionClient(Settings.Default.ConnectionServiceUrl); @@ -527,6 +527,7 @@ private bool ConnectRemoteServer() var loginUser = user.Value; var loginPassword = string.IsNullOrEmpty(passwordHash.Value) ? password.Value : CryptoHelper.RDP_Decrypt(passwordHash.Value); var startProgram = program.Value; + var loadBalanceInfoValue = loadBalanceInfo.Value; // allowed features var allowRemoteClipboard = _allowRemoteClipboard; @@ -670,7 +671,8 @@ private bool ConnectRemoteServer() maxActiveGuests, Session.SessionID, (string)Session[HttpSessionStateVariables.ClientKey.ToString()], - Request["cid"] != null + Request["cid"] != null, + loadBalanceInfoValue ); // bind the remote session to the current http session diff --git a/Myrtille.Web/Default.aspx.designer.cs b/Myrtille.Web/Default.aspx.designer.cs index 1ff4e59..740645d 100644 --- a/Myrtille.Web/Default.aspx.designer.cs +++ b/Myrtille.Web/Default.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace Myrtille.Web { - - - public partial class Default { - +namespace Myrtille.Web +{ + + + public partial class Default + { + /// /// mainForm control. /// @@ -20,7 +22,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm mainForm; - + /// /// width control. /// @@ -29,7 +31,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputHidden width; - + /// /// height control. /// @@ -38,7 +40,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputHidden height; - + /// /// login control. /// @@ -47,7 +49,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl login; - + /// /// logo control. /// @@ -56,7 +58,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl logo; - + /// /// hostConnectDiv control. /// @@ -65,7 +67,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl hostConnectDiv; - + /// /// hostType control. /// @@ -74,7 +76,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlSelect hostType; - + /// /// securityProtocol control. /// @@ -83,7 +85,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlSelect securityProtocol; - + /// /// server control. /// @@ -92,7 +94,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText server; - + /// /// vmGuid control. /// @@ -101,7 +103,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText vmGuid; - + /// /// vmEnhancedMode control. /// @@ -110,7 +112,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputCheckBox vmEnhancedMode; - + /// /// domain control. /// @@ -119,7 +121,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText domain; - + /// /// user control. /// @@ -128,7 +130,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText user; - + /// /// password control. /// @@ -137,7 +139,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputPassword password; - + /// /// passwordHash control. /// @@ -146,7 +148,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputHidden passwordHash; - + /// /// mfaDiv control. /// @@ -155,7 +157,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl mfaDiv; - + /// /// mfaProvider control. /// @@ -164,7 +166,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlAnchor mfaProvider; - + /// /// mfaPassword control. /// @@ -173,7 +175,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText mfaPassword; - + /// /// program control. /// @@ -182,7 +184,16 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText program; - + + /// + /// loadBalanceInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlInputText loadBalanceInfo; + /// /// connect control. /// @@ -191,7 +202,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputSubmit connect; - + /// /// adminDiv control. /// @@ -200,7 +211,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl adminDiv; - + /// /// adminUrl control. /// @@ -209,7 +220,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlAnchor adminUrl; - + /// /// adminText control. /// @@ -218,7 +229,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl adminText; - + /// /// connectError control. /// @@ -227,7 +238,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl connectError; - + /// /// hosts control. /// @@ -236,7 +247,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl hosts; - + /// /// enterpriseUserInfo control. /// @@ -245,7 +256,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText enterpriseUserInfo; - + /// /// newRDPHost control. /// @@ -254,7 +265,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton newRDPHost; - + /// /// newSSHHost control. /// @@ -263,7 +274,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton newSSHHost; - + /// /// logout control. /// @@ -272,7 +283,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton logout; - + /// /// hostsList control. /// @@ -281,7 +292,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Repeater hostsList; - + /// /// toolbarToggle control. /// @@ -290,7 +301,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl toolbarToggle; - + /// /// toolbar control. /// @@ -299,7 +310,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl toolbar; - + /// /// serverInfo control. /// @@ -308,7 +319,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText serverInfo; - + /// /// userInfo control. /// @@ -317,7 +328,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText userInfo; - + /// /// scale control. /// @@ -326,7 +337,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton scale; - + /// /// reconnect control. /// @@ -335,7 +346,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton reconnect; - + /// /// keyboard control. /// @@ -344,7 +355,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton keyboard; - + /// /// osk control. /// @@ -353,7 +364,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton osk; - + /// /// clipboard control. /// @@ -362,7 +373,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton clipboard; - + /// /// files control. /// @@ -371,7 +382,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton files; - + /// /// cad control. /// @@ -380,7 +391,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton cad; - + /// /// mrc control. /// @@ -389,7 +400,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton mrc; - + /// /// vswipe control. /// @@ -398,7 +409,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton vswipe; - + /// /// share control. /// @@ -407,7 +418,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton share; - + /// /// disconnect control. /// @@ -416,7 +427,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton disconnect; - + /// /// imageQuality control. /// diff --git a/Myrtille.Web/SendInputs.aspx.cs b/Myrtille.Web/SendInputs.aspx.cs index f1d4def..13be441 100644 --- a/Myrtille.Web/SendInputs.aspx.cs +++ b/Myrtille.Web/SendInputs.aspx.cs @@ -106,7 +106,8 @@ protected void Page_Load( remoteSession.ClientHeight, remoteSession.AllowRemoteClipboard, remoteSession.AllowPrintDownload, - remoteSession.AllowAudioPlayback); + remoteSession.AllowAudioPlayback, + remoteSession.LoadBalanceInfo); } catch (Exception exc) { diff --git a/Myrtille.Web/src/Clients/RemoteSessionProcessClient.cs b/Myrtille.Web/src/Clients/RemoteSessionProcessClient.cs index 8be684d..a2f54ec 100644 --- a/Myrtille.Web/src/Clients/RemoteSessionProcessClient.cs +++ b/Myrtille.Web/src/Clients/RemoteSessionProcessClient.cs @@ -70,7 +70,8 @@ public void StartProcess( int clientHeight, bool allowRemoteClipboard, bool allowPrintDownload, - bool allowAudioPlayback) + bool allowAudioPlayback, + string loadBalancerInfo) { Trace.TraceInformation("Calling service start process, remote session {0}, server {1}, domain {2}, user {3}, program {4}", remoteSessionId, serverAddress, string.IsNullOrEmpty(userDomain) ? "(none)" : userDomain, userName, string.IsNullOrEmpty(startProgram) ? "(none)" : startProgram); @@ -91,7 +92,8 @@ public void StartProcess( clientHeight, allowRemoteClipboard, allowPrintDownload, - allowAudioPlayback); + allowAudioPlayback, + loadBalancerInfo); _processStarted = true; } diff --git a/Myrtille.Web/src/Handlers/RemoteSessionSocketHandler.cs b/Myrtille.Web/src/Handlers/RemoteSessionSocketHandler.cs index cadef84..1b643b5 100644 --- a/Myrtille.Web/src/Handlers/RemoteSessionSocketHandler.cs +++ b/Myrtille.Web/src/Handlers/RemoteSessionSocketHandler.cs @@ -146,7 +146,8 @@ public override void OnOpen() _remoteSession.ClientHeight, _remoteSession.AllowRemoteClipboard, _remoteSession.AllowPrintDownload, - _remoteSession.AllowAudioPlayback); + _remoteSession.AllowAudioPlayback, + _remoteSession.LoadBalanceInfo); } catch (Exception exc) { diff --git a/Myrtille.Web/src/RemoteSession.cs b/Myrtille.Web/src/RemoteSession.cs index 2861688..67ad99f 100644 --- a/Myrtille.Web/src/RemoteSession.cs +++ b/Myrtille.Web/src/RemoteSession.cs @@ -69,6 +69,7 @@ public class RemoteSession public bool Reconnect; public bool ConnectionService; public string ClipboardText; // clipboard text + public string LoadBalanceInfo; public RemoteSession( Guid id, @@ -93,7 +94,8 @@ public RemoteSession( int maxActiveGuests, string ownerSessionID, string ownerClientKey, - bool connectionService) + bool connectionService, + string loadBalanceInfoValue) { Id = id; State = RemoteSessionState.NotConnected; @@ -120,6 +122,7 @@ public RemoteSession( OwnerSessionID = ownerSessionID; OwnerClientKey = ownerClientKey; ConnectionService = connectionService; + LoadBalanceInfo = loadBalanceInfoValue; // default capture API config ScreenshotIntervalSecs = 60; From f7b1eb2ff9e55d95c6f08b3045abbb018adfaf9c Mon Sep 17 00:00:00 2001 From: sme-schleupen Date: Mon, 13 Sep 2021 13:15:05 +0200 Subject: [PATCH 2/3] Added LoadBalanceInfo to ConnectionInfo --- Myrtille.Services.Contracts/Models/ConnectionInfo.cs | 1 + Myrtille.Web/Default.aspx.cs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Myrtille.Services.Contracts/Models/ConnectionInfo.cs b/Myrtille.Services.Contracts/Models/ConnectionInfo.cs index 094f3e7..4c9e14c 100644 --- a/Myrtille.Services.Contracts/Models/ConnectionInfo.cs +++ b/Myrtille.Services.Contracts/Models/ConnectionInfo.cs @@ -36,5 +36,6 @@ public class ConnectionInfo ///
public string StartProgram { get; set; } public string GatewayUrl { get; set; } + public string LoadBalanceInfo { get; set; } } } \ No newline at end of file diff --git a/Myrtille.Web/Default.aspx.cs b/Myrtille.Web/Default.aspx.cs index aeaab9c..6d849f5 100644 --- a/Myrtille.Web/Default.aspx.cs +++ b/Myrtille.Web/Default.aspx.cs @@ -527,7 +527,7 @@ private bool ConnectRemoteServer() var loginUser = user.Value; var loginPassword = string.IsNullOrEmpty(passwordHash.Value) ? password.Value : CryptoHelper.RDP_Decrypt(passwordHash.Value); var startProgram = program.Value; - var loadBalanceInfoValue = loadBalanceInfo.Value; + var loadBalanceInfoValue = loadBalanceInfo?.Value; // allowed features var allowRemoteClipboard = _allowRemoteClipboard; @@ -621,6 +621,8 @@ private bool ConnectRemoteServer() allowAudioPlayback = allowAudioPlayback && connection.AllowAudioPlayback; maxActiveGuests = connection.MaxActiveGuests; + + loadBalanceInfoValue = connection.LoadBalanceInfo; } catch (Exception exc) { From ca52590d41a3e7fe6de0afb343f91fb09b78c025 Mon Sep 17 00:00:00 2001 From: sme-schleupen Date: Mon, 13 Sep 2021 15:44:20 +0200 Subject: [PATCH 3/3] Added comment --- Myrtille.Services/RemoteSessionProcess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Myrtille.Services/RemoteSessionProcess.cs b/Myrtille.Services/RemoteSessionProcess.cs index 279929a..8c2fdb8 100644 --- a/Myrtille.Services/RemoteSessionProcess.cs +++ b/Myrtille.Services/RemoteSessionProcess.cs @@ -355,7 +355,7 @@ public void StartProcess( (securityProtocol != SecurityProtocol.auto ? " /sec:" + securityProtocol.ToString() : string.Empty) + // security protocol (allowAudioPlayback ? " /sound" : string.Empty) + // sound support " /audio-mode:" + (allowAudioPlayback ? "0" : "2") + // audio mode (0: redirect, 1: play on server, 2: do not play) - (!string.IsNullOrEmpty(loadBalanceInfo) ? " /load-balance-info:\"" + loadBalanceInfo +"\"" : string.Empty); + (!string.IsNullOrEmpty(loadBalanceInfo) ? " /load-balance-info:\"" + loadBalanceInfo +"\"" : string.Empty); // load balance info from RDS-file } #endregion