diff --git a/src/RoyalApps.Community.Rdp.WinForms/Controls/RdpClientExtensions.cs b/src/RoyalApps.Community.Rdp.WinForms/Controls/RdpClientExtensions.cs index 23d7d4c..d9a7619 100644 --- a/src/RoyalApps.Community.Rdp.WinForms/Controls/RdpClientExtensions.cs +++ b/src/RoyalApps.Community.Rdp.WinForms/Controls/RdpClientExtensions.cs @@ -55,8 +55,10 @@ public static void ApplyRdpClientConfiguration(this RdpControl rdpControl, RdpCl } TraceConfigurationData(logger, configuration.Credentials); - rdpClient.UserName = string.IsNullOrEmpty(configuration.Credentials.Username) ? null : configuration.Credentials.Username; - rdpClient.Domain = string.IsNullOrEmpty(configuration.Credentials.Domain) ? null : configuration.Credentials.Domain; + if (!string.IsNullOrEmpty(configuration.Credentials.Username)) + rdpClient.UserName = configuration.Credentials.Username; + if (!string.IsNullOrEmpty(configuration.Credentials.Domain)) + rdpClient.Domain = configuration.Credentials.Domain; var password = configuration.Credentials.Password?.GetValue(); if (!string.IsNullOrEmpty(password)) rdpClient.Password = password;