Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get local computer name via Citrix session in .NET

Tags:

.net

citrix

I need to get the local Computer Name for a desktop computer running our software application through a Citrix session. When I query My.Computer.Name I get the name of the server.

How can I get the name of the actual physical computer that the session is running on, and is there there an event I can monitor for when someone switches a session from one computer to another?

like image 240
Molloch Avatar asked Jul 25 '10 12:07

Molloch


1 Answers

Found a server variable as Kobi suggested above:

%CLIENTNAME%

it is only populated in Terminal Services or Citrix, expanding it on you local PC will return %CLIENTNAME%. However, on a citrix or RDP server it works great. The .net code I am using is:

TSHostName = Environment.ExpandEnvironmentVariables("%CLIENTNAME%")

like image 124
Molloch Avatar answered Nov 18 '22 11:11

Molloch