Get computer name, IP address, current user in .NET.

xiaoxiao2021-03-06  113

Get a computer name in .NET, IP address and current username are very simple. The following is a few ways I have commonly used. If you have other good methods, you can reply together:

1. Special properties in ASP.NET:

Get server computer name: Page.Server.manchinename

Get User Information: Page.user

Get the client computer name: page.Request.Userhostname

Get Client Computer IP: Page.Request.userHostAddress

2. General methods in network programming:

Get the current computer name: static system.net.dns.getHostName ()

Remove all IP addresses according to the computer name: static system.net.dns.resolve (computer name) .addresslist

You can also remove the computer name according to the IP address: static system.net.dns.resolve (IP address) .hostname

3. General attributes of the system environment:

Current computer name: static system.environment.machinename

Current computer belongs: static system.environment.userdomainname

Current computer user: static system.environment.username

................................................ ................................................ .

转载请注明原文地址:https://www.9cbs.com/read-126518.html

New Post(0)