string hostName = Dns.GetHostName(); //獲得主機名稱<br /> IPAddress[] addressList = Dns.GetHostByName(hostName).AddressList; //獲得 IP 列表</p><p> HttpBrowserCapabilities bc = Request.Browser;</p><p> //lab_info是用來顯示擷取到的資訊<br /> lab_info.Text = "" + "<br>";<br /> lab_info.Text += "主機名稱:" + hostName + "<br>";<br /> lab_info.Text += " IP:";<br /> for (int i = 0; i < addressList.Length; i++)<br /> lab_info.Text += addressList.GetValue(i).ToString() + "<br>";<br /> lab_info.Text += "<br>"+"作業系統:" + bc.Platform + "<br>";<br /> lab_info.Text += "是否是 Win16 系統:" + bc.Win16 + "<br>";<br /> lab_info.Text += "是否是 Win32 系統:" + bc.Win32 + "<br>";<br /> lab_info.Text += "---<br>";</p><p> lab_info.Text += "瀏覽器:" + bc.Browser + "<br>";<br /> lab_info.Text += "瀏覽器標識:" + bc.Id + "<br>";<br /> lab_info.Text += "瀏覽器版本:" + bc.Version + "<br>";<br /> lab_info.Text += "瀏覽器 MajorVersion:" + bc.MajorVersion.ToString() + "<br>";<br /> lab_info.Text += "瀏覽器 MinorVersion:" + bc.MinorVersion.ToString() + "<br>";<br /> lab_info.Text += "瀏覽器是否是測試版本:" + bc.Beta.ToString() + "<br>";<br /> lab_info.Text += "是否是 America Online 瀏覽器:" + bc.AOL + "<br>";<br /> lab_info.Text += "用戶端安裝的 .NET Framework 版本:" + bc.ClrVersion + "<br>"; //即使安裝了 .NET Framework,如果不是 IE 瀏覽器,檢測版本都是 0.0。<br /> lab_info.Text += "是否是搜尋引擎的網路爬蟲:" + bc.Crawler + "<br>";<br /> lab_info.Text += "是否是行動裝置:" + bc.IsMobileDevice + "<br>";<br /> lab_info.Text += "---<br>";</p><p> lab_info.Text += "顯示的色彩深度:" + bc.ScreenBitDepth + "<br>";<br /> lab_info.Text += "顯示的近似寬度(以字元行為單位):" + bc.ScreenCharactersWidth + "<br>";<br /> lab_info.Text += "顯示的近似高度(以字元行為單位):" + bc.ScreenCharactersHeight + "<br>";<br /> lab_info.Text += "顯示的近似寬度(以像素行為單位):" + bc.ScreenPixelsWidth + "<br>";<br /> lab_info.Text += "顯示的近似高度(以像素行為單位):" + bc.ScreenPixelsHeight + "<br>";<br /> lab_info.Text += "---<br>";</p><p> lab_info.Text += "是否支援 CSS:" + bc.SupportsCss + "<br>";<br /> lab_info.Text += "是否支援 ActiveX 控制項:" + bc.ActiveXControls.ToString() + "<br>";<br /> lab_info.Text += "是否支援 JavaApplets:" + bc.JavaApplets.ToString() + "<br>";<br /> lab_info.Text += "是否支援 JavaScript:" + bc.JavaScript.ToString() + "<br>";<br /> lab_info.Text += "JScriptVersion:" + bc.JScriptVersion.ToString() + "<br>";<br /> lab_info.Text += "是否支援 VBScript:" + bc.VBScript.ToString() + "<br>";<br /> lab_info.Text += "是否支援 Cookies:" + bc.Cookies + "<br>";<br /> lab_info.Text += "支援的 MSHTML 的 DOM 版本:" + bc.MSDomVersion + "<br>";<br /> lab_info.Text += "支援的 W3C 的 DOM 版本:" + bc.W3CDomVersion + "<br>";<br /> lab_info.Text += "是否支援通過 HTTP 接收 XML:" + bc.SupportsXmlHttp + "<br>";<br /> lab_info.Text += "是否支援架構:" + bc.Frames.ToString() + "<br>";<br /> lab_info.Text += "超連結 a 屬性 href 值的最大長度:" + bc.MaximumHrefLength + "<br>";<br /> lab_info.Text += "是否支援表格:" + bc.Tables + "<br>";
HttpBrowserCapabilities 的命名空間是:System.Web.
AddressList 返回 IP 數組