Detecting remote desktop connection

前端 未结 9 1667
北恋
北恋 2020-11-30 19:51

Is there anyway, in a program, to detect if a program is being run from inside a remote desktop session or if the program is being run normal in .NET 2.0? What I\'m trying t

9条回答
  •  情歌与酒
    2020-11-30 20:38

    http://www.appdeploy.com/messageboards/tm.asp?m=21420&mpage=1&key=厬

    The system variable %sessionname% will return Console if its local or RDP* if its remote.

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

提交回复
热议问题