c# - Check whether application is running under Terminal Services as opposed to Remote Desktop -


i have .net application need able disallow running on terminal services server licensing reasons. aware of systeminformation api determine if program running under remote session (as detailed in this question example). however, api not distinguish between application running on normal server has 2 allowed remote desktop sessions , full-blown terminal server might have 500 sessions running on it.

is there simple programmatic way can determine whether application running on full-on terminal server?

i fine assumption more 2 allowed sessions means full-on terminal server, , fine p/invoke if that's what's required.

one way use below code:

    string s = system.environment.getenvironmentvariable("sessionname"); 

if value of s "console", running in terminal services. on other hand, if value "rdp-tcp#01", running under remote desktop.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -