To get the IP address of a user in C#, you can use the System.Net.Sockets.Socket class. Here is an example:
main.cs477 chars14 lines
This code creates a new socket and connects to a server (in this case, example.com on port 80). It then gets the local endpoint of the socket, which contains the client's IP address and port number. The IP address is stored in the Address property of the IPEndPoint object, which can be used for further processing. Finally, the socket is closed.
gistlibby LogSnag