Asp. NET get client, server-side information

Source: Internet
Author: User
Tags httpcontext servervariables to domain

Asp. NET gets the client, server-side basic information 1. Private properties in asp: Get Server computer name: Page.Server.ManchineName Get user information: Page.User get the client computer name: Page.Request.UserHostName Get client PC IP:Page.Request.UserHostAddress 2. Common methods in Network programming: Get the current computer name: Static System.Net.Dns.GetHostName () remove all IP addresses according to the computer name: Static System.Net.Dns.Resolve (computer name). AddressList can also take out the computer name according to the IP address: static System.Net.Dns.Resolve (IP address). HostName 3. Common properties of the system environment class: Current computer name: Static System.Environment.MachineName the current computer belongs to domain: static System.Environment.UserDomainName Current computer User: static System.Environment.UserName client IP:Page.Request.UserHostAddress; user information: Page.User; Server computer name: Page.Server.MachineName; Current user computer name: System.Net.Dns.GetHostName (); current computer name: System.Environment.MachineName; The current computer belongs to the domain: System.Environment.UserDomainName; current computer User: System.Environment.UserName; browser type: Request.Browser.Browser; Browser ID: Request.Browser.Id; browser version number: Request.Browser.Version; browser is not beta version: Request.Browser.Beta; browser resolution (pixels): request[" Width "]. ToString () + "*" + request["height"]. ToString ();//1280*1024 client's operating system: Request.Browser.Platform; Win16 system: Request.Browser.Win16; Win32 system: REQUEST.BROWSER.WIN32; server-side information: Server computer Name: "/http" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath; server IIS version: request.servervariables["Server_software"]. ToString (); Server domain name: request.servervariables["SERVER_NAME"]. ToString (); Server port: request.servervariables["Server_port"]. ToString (); Server IP address: request.servervariables["LOCAL_ADDR"] Server script time-out: (server.scripttimeout/1000). ToString () + "seconds"; server operating system: Environment.OSVersion.ToString (); folder in which this file is located: Request.physicalapplicationpath; server IE version: Registry.LocalMachine.OpenSubKey (@ "software/microsoft/internet explorer/version Vector"). GetValue ("IE", "not detected"). ToString (); The System folder: Environment.SystemDirectory.ToString (); Current time of the server: DateTime.Now.ToString (); The language type of the server: CultureInfo.InstalledUICulture.EnglishName: ((ENVIRONMENT.TICKCOUNT/0X3E8)/60) when the server was last booted to its current run time. ToString () + "minute"; CPU type: environment.getenvironmentvariable ("Processor_identifier"). ToString (); logical drive: string[] achdrives = Directory.getlogicaldrives (); for (int i = 0; i <Directory.getlogicaldrives (). Length-1; i++) {Achdrives[i]. ToString ();} Total CPUs: environment.getenvironmentvariable ("Number_of_processors"). ToString (); Virtual memory: (environment.workingset/1024). ToString () + "M";. NET Framework Version: String. Concat (new object[] {Environment.Version.Major, ".", Environment.Version.Minor, Environment.Version.Build, ".", Environment.Version.Revision}); asp: (TimeSpan) process.getcurrentprocess (). Totalprocessortime). Totalseconds.tostring ("N0"); ASP.: ((Double) process.getcurrentprocess (). workingset64/1048576). ToString ("N2") + "M"; Current Session Number: Session.Contents.Count.ToString (); The current program Consumes memory: ((Double) GC. Gettotalmemory (FALSE)/1048576). ToString ("N2") + "M"; current SessionID:Session.Contents.SessionID; current system user name: environment.username;//The snippet is from:/http www.sharejs.com/codes/csharp/1117

  

Asp. NET get client, server-side information

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.