It is very simple to obtain a computer name, IP address and current user name in .NET. The following are several methods I commonly use. If you have other good methods, you can reply and organize them together:
1. In ASP.NET Special properties:
Get the server computer name: Page.Server.ManchineName
Get user information: Page.User
Get the client computer name: Page.Request.UserHostName
Get the client computer IP: Page.Request.UserHostAddress
2. Common methods in network programming:
Get the current computer name: static System.Net.Dns.GetHostName()
Retrieve all IP addresses based on the computer name: static System.Net.Dns.Resolve(computer name).AddressList
You can also retrieve the computer name based on the IP address: static System.Net.Dns.Resolve(IP address).HostName
3. Common attributes of the system environment class:
Current computer name: static System.Environment.MachineName
The domain the current computer belongs to: static System.Environment.UserDomainName
Current computer user: static System.Environment.UserName