C # check RDP user login

I am writing a C # program that is used on a desktop or server OS. And I need to know that the current user is working through RDP. How can I get this information?

+4
source share
1 answer

The system variable% sessionname% will return the Console if it is local or RDP * if it is remote.

isRDP = [System.Environment]
    .GetEnvironmentVariable("SESSIONNAME").StartsWith("RDP-")
+1
source

All Articles