Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Citrix: Retrieving the client name

Status
Not open for further replies.

Viruland

Programmer
Dec 6, 2000
61
BE
I have an application that is installed on one of our servers. Through a Citrix ICA Connection, users can access this program from their PC. Is there a way that I can extract the client name (= client PC Name).

Live fast, die young and leave a beautiful corpse behind.
 
We use Citrix also. One thing to keep in mind is when the user is logging into the Citrix server they are logging onto windows so you can grab it normally. Here are two options to choose from:

Code:
    Public Function GetUserName() As String
        'Determine if Windows Authentication is being used
        If TypeOf My.User.CurrentPrincipal Is _
        Security.Principal.WindowsPrincipal Then
            ' The application is using Windows authentication.
            ' The name format is DOMAIN\USERNAME.
            Dim strSplit() As String = Split(My.User.Name, "\")
            Dim strUserName As String = strSplit(1)
            Return strUserName
        Else
            ' The application is using custom authentication.
            Return My.User.Name
        End If
    End Function

OR

Code:
System.Environment.UserName

Hope this helps.

Matt
 
Mat,

The code you gave me is for extracting the username, but I I want to know the clients PC Name, not the Client Name.

Kristof

Live fast, die young and leave a beautiful corpse behind.
 
I see that is a little tougher. To get that you will have to use a Citrix object. You have probably found that you get the server name when you try and grab the machine name with System.Environment.MachineName. Try the Metaframecom object from this you should be able to get the session and PC Name.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top