1. 在asp.Net中专用属性: 获取服务器电脑名: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 举例子来说明: using system.Net; private void buttonip_click(object sender, system.eventargs e) { system.Net.ipaddress[] addresslist = dns.gethostbyname(dns.gethostname()).addresslist; if (addresslist.length>1) { textlip.text = addresslist[0].tostring(); textsip.text = addresslist[1].tostring(); } else { textlip.text = addresslist[0].tostring(); textsip.text = "没有可用的连接"; } }