Several common methods are required when network programming is involved.
1. Special attributes in ASP. NET:
Get Server computer name: Page. Server. ManchineName
Get User information: Page. User
Obtain the client computer name: Page. Request. UserHostName
Obtain the Client IP Address: Page. Request. UserHostAddress
2. General 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 obtain the computer name static System. Net. Dns. Resolve (IP address). HostName Based on the IP address.
3. General attributes of the system environment:
Current computer name: static System. Environment. MachineName
Domain Name of the current computer: static System. Environment. UserDomainName
Current computer user: static System. Environment. UserName