2 つのシステムがあるとします。システム 1 とシステム 2。
- システム1 - Windows XP
- システム 2 - Linux。
System1 に WPF アプリケーションをインストールしました。System2 のユーザーは、リモート デスクトップ接続を介して System1 に接続し、WPF アプリケーションを起動します。
WPF アプリケーションでは、次のコードを使用して System1 のローカル IP アドレスと Windows ログイン名を取得できます。
private String GetIP()
{
string strHostName = "";
strHostName = System.Net.Dns.GetHostName();
IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
IPAddress[] addr = ipEntry.AddressList;
return addr[0].ToString();
}
String WinUserName_withNetwork = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
String WinUserNameOnly = System.Environment.UserName;
私の問題は、System2 からログインしているユーザーの IP アドレスとユーザー名が必要なことです。
その IP アドレスとユーザー名を取得するにはどうすればよいですか?