以下几种方法可以获得服务器端和客户端的IP地址和计算机名
1.
获取服务器电脑名:Page.Server.ManchineName
获取用户信息:Page.User
获取客户端电脑名:Page.Request.UserHostName
获取客户端电脑IP:Page.Request.UserHostAddress
2.
获取当前电脑名:static System.Net.Dns.GetHostName()
根据电脑名取出全部IP地址:static System.Net.Dns.Resolve(电脑名).AddressList
也可根据IP地址取出电脑名:static System.Net.Dns.Resolve(IP地址).HostName
3.
当前电脑名:static System.Environment.MachineName
当前电脑所属网域:static System.Environment.UserDomainName
当前电脑用户:static System.Environment.UserName
获取客户端的信息
//IP
System.Net.IPAddress ip = System.Net.IPAddress.Parse(Request.UserHostAddress);
System.Net.IPHostEntry ihe = Dns.GetHostEntry(ip);
//机器名
string clientname = ihe.HostName;
System.Net.IPAddress ip = System.Net.IPAddress.Parse(Request.UserHostAddress);
System.Net.IPHostEntry ihe = Dns.GetHostEntry(ip);
//机器名
string clientname = ihe.HostName;