Asp. NET to obtain information about clients and servers

Source: Internet
Author: User
Tags httpcontext servervariables to domain

Client Information:

1. Private properties in asp:
Get Server computer name: Page.Server.ManchineName
Get user information: Page.User
Get client computer name: Page.Request.UserHostName
Get client PC IP:Page.Request.UserHostAddress

2. Common methods in Network programming:
Get current computer name: Static System.Net.Dns.GetHostName ()
Remove all IP addresses by computer name: Static System.Net.Dns.Resolve (computer name). AddressList
You can also remove the computer name by 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
Current computer belongs to domain: static System.Environment.UserDomainName
Current PC 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;
is not Win16 system: Request.Browser.Win16;
is not 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 Timeout time: (server.scripttimeout/1000). ToString () + "second";

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 is located in the folder: Environment.SystemDirectory.ToString ();

Server Current time: DateTime.Now.ToString ();

Server language type: CultureInfo.InstalledUICulture.EnglishName;

Server last boot to now run Time: ((ENVIRONMENT.TICKCOUNT/0X3E8)/60). 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 ();

Current program Consumes Memory: ((Double) GC. Gettotalmemory (FALSE)/1048576). ToString ("N2") + "M";

Current SessionID:Session.Contents.SessionID;

Current system user name: Environment.username;

Asp. NET to obtain information about clients and servers

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: 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.