ASP. NET -- get client browser information and server host name and IP address

Source: Internet
Author: User

String hostname = DNS. gethostname (); // obtain the host name <br/> IPaddress [] Addresslist = DNS. gethostbyname (hostname ). addresslist; // obtain the IP list </P> <p> httpbrowsercapabilities BC = request. browser; </P> <p> // lab_info is used to display the obtained information. <br/> lab_info.text = "" + "<br> "; <br/> lab_info.text + = "Host Name:" + 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>" + "Operating System:" + BC. platform + "<br>"; <br/> lab_info.text + = "whether it is a Win16 system:" + BC. win16 + "<br>"; <br/> lab_info.text + = "whether it is a Win32 system:" + BC. win32 + "<br>"; <br/> lab_info.text + = "--- <br>"; </P> <p> lab_info.text + = "browser:" + BC. browser + "<br>"; <br/> lab_info.text + = "browser ID:" + BC. ID + "<br>"; <br/> lab_info.text + = "browser version:" + BC. version + "<br>"; <br/> lab_info.text + = "browser majorversion:" + BC. majorversion. tostring () + "<br>"; <br/> lab_info.text + = "browser minorversion:" + BC. minorversion. tostring () + "<br>"; <br/> lab_info.text + = "Whether the browser is a test version:" + BC. beta. tostring () + "<br>"; <br/> lab_info.text + = "is America Online Browser:" + BC. AOL + "<br>"; <br/> lab_info.text + = "client installed. net Framework Version: "+ BC. clrversion + "<br> ";// Even if the. NET Framework is installed, if it is not an IE browser, all versions of the test are 0.0. <Br/> lab_info.text + = "whether it is a search engine web crawler:" + BC. crawler + "<br>"; <br/> lab_info.text + = "whether it is a mobile device:" + BC. ismobiledevice + "<br>"; <br/> lab_info.text + = "--- <br>"; </P> <p> lab_info.text + = "displayed color depth: "+ BC. screenbitdepth + "<br>"; <br/> lab_info.text + = "approximate width of Display (in characters):" + BC. screencharacterswidth + "<br>"; <br/> lab_info.text + = "the approximate height of the display (measured in characters):" + BC. screencharactersheight + "<br>"; <br/> lab_info.text + = "display approximate width (in pixel behavior units):" + BC. screenpixelswidth + "<br>"; <br/> lab_info.text + = "Approximate height (in pixel behavior units):" + BC. screenpixelsheight + "<br>"; <br/> lab_info.text + = "--- <br>"; </P> <p> lab_info.text + = "whether CSS is supported: "+ BC. supportscss + "<br>"; <br/> lab_info.text + = "whether ActiveX control is supported:" + BC. activexcontrols. tostring () + "<br>"; <br/> lab_info.text + = "supported javaapplets:" + BC. javaapplets. tostring () + "<br>"; <br/> lab_info.text + = "Support for javascript:" + BC. javaScript. tostring () + "<br>"; <br/> lab_info.text + = "jscriptversion:" + BC. jscriptversion. tostring () + "<br>"; <br/> lab_info.text + = "Support for VBScript:" + BC. VBScript. tostring () + "<br>"; <br/> lab_info.text + = "whether cookies are supported:" + BC. cookies + "<br>"; <br/> lab_info.text + = "supported Dom versions of mshtml:" + BC. msdomversion + "<br>"; <br/> lab_info.text + = "supported W3C Dom versions:" + BC. w3cdomversion + "<br>"; <br/> lab_info.text + = "Support for receiving XML via http:" + BC. supportsxmlhttp + "<br>"; <br/> lab_info.text + = "supported framework:" + BC. frames. tostring () + "<br>"; <br/> lab_info.text + = "Maximum length of href value in hyperlink A:" + BC. maximumhreflength + "<br>"; <br/> lab_info.text + = "table supported:" + BC. tables + "<br> ";

The namespace of httpbrowsercapabilities is: system. Web.

Addresslist

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.