string hostName = Dns.GetHostName(); //获得主机名 IPAddress[] addressList = Dns.GetHostByName(hostName).AddressList; //获得 IP 列表 HttpBrowserCapabilities bc = Request.Browser; //lab_info是用来显示获取到的信息 lab_info.Text = "" + "<br>"; lab_info.Text += "主机名:" + hostName + "<br>"; lab_info.Text += " IP:"; for (int i = 0; i < addressList.Length; i++) lab_info.Text += addressList.GetValue(i).ToString() + "<br>"; lab_info.Text += "<br>"+"操作系统:" + bc.Platform + "<br>"; lab_info.Text += "是否是 Win16 系统:" + bc.Win16 + "<br>"; lab_info.Text += "是否是 Win32 系统:" + bc.Win32 + "<br>"; lab_info.Text += "---<br>"; lab_info.Text += "浏览器:" + bc.Browser + "<br>"; lab_info.Text += "浏览器标识:" + bc.Id + "<br>"; lab_info.Text += "浏览器版本:" + bc.Version + "<br>"; lab_info.Text += "浏览器 MajorVersion:" + bc.MajorVersion.ToString() + "<br>"; lab_info.Text += "浏览器 MinorVersion:" + bc.MinorVersion.ToString() + "<br>"; lab_info.Text += "浏览器是否是测试版本:" + bc.Beta.ToString() + "<br>"; lab_info.Text += "是否是 America Online 浏览器:" + bc.AOL + "<br>"; lab_info.Text += "客户端安装的 .NET Framework 版本:" + bc.ClrVersion + "<br>"; //即使安装了 .NET Framework,如果不是 IE 浏览器,检测版本都是 0.0。 lab_info.Text += "是否是搜索引擎的网络爬虫:" + bc.Crawler + "<br>"; lab_info.Text += "是否是移动设备:" + bc.IsMobileDevice + "<br>"; lab_info.Text += "---<br>"; lab_info.Text += "显示的颜色深度:" + bc.ScreenBitDepth + "<br>"; lab_info.Text += "显示的近似宽度(以字符行为单位):" + bc.ScreenCharactersWidth + "<br>"; lab_info.Text += "显示的近似高度(以字符行为单位):" + bc.ScreenCharactersHeight + "<br>"; lab_info.Text += "显示的近似宽度(以像素行为单位):" + bc.ScreenPixelsWidth + "<br>"; lab_info.Text += "显示的近似高度(以像素行为单位):" + bc.ScreenPixelsHeight + "<br>"; lab_info.Text += "---<br>"; lab_info.Text += "是否支持 CSS:" + bc.SupportsCss + "<br>"; lab_info.Text += "是否支持 ActiveX 控件:" + bc.ActiveXControls.ToString() + "<br>"; lab_info.Text += "是否支持 JavaApplets:" + bc.JavaApplets.ToString() + "<br>"; lab_info.Text += "是否支持 JavaScript:" + bc.JavaScript.ToString() + "<br>"; lab_info.Text += "JScriptVersion:" + bc.JScriptVersion.ToString() + "<br>"; lab_info.Text += "是否支持 VBScript:" + bc.VBScript.ToString() + "<br>"; lab_info.Text += "是否支持 Cookies:" + bc.Cookies + "<br>"; lab_info.Text += "支持的 MSHTML 的 DOM 版本:" + bc.MSDomVersion + "<br>"; lab_info.Text += "支持的 W3C 的 DOM 版本:" + bc.W3CDomVersion + "<br>"; lab_info.Text += "是否支持通过 HTTP 接收 XML:" + bc.SupportsXmlHttp + "<br>"; lab_info.Text += "是否支持框架:" + bc.Frames.ToString() + "<br>"; lab_info.Text += "超链接 a 属性 href 值的最大长度:" + bc.MaximumHrefLength + "<br>"; lab_info.Text += "是否支持表格:" + bc.Tables + "<br>"; HttpBrowserCapabilities 的命名空间是:System.Web. AddressList 返回 IP 数组