Is there any way, on a windows domain, to get hostname or IP address given the domain username? C# APIs would be great.
example: string GetUserIP(string username);
Is there any way, on a windows domain, to get hostname or IP address given the domain username? C# APIs would be great.
example: string GetUserIP(string username);
The short answer is that you can't find the information because the IP address is assigned to a computer and not a user. Now you might be able to find out the IP address of the computer a user logged into. The first step would be to talk with the domain administrator. Find out if they are logging the information. They may also be able to point you to how to search the log (that is with a huge assumption that the domain admin will cooperate which is NOT guaranteed).
Now having said that if others are connecting to your application it is relatively easy to get the IP address from where they are connecting. You simply exam the connection property in the connection after it has been established.
I ended up creating a client-side application that runs on logon (by adding the correct registry key. See Here) You could also implement this as part of a logon script. This connected to the remote service and reported the username. The server application then maintained a dictionary of logged-on users and IPs.