Home > Backend Development > C#.Net Tutorial > asp.net Get server information

asp.net Get server information

伊谢尔伦
Release: 2016-11-25 09:34:53
Original
1272 people have browsed it

Response.Write("服务器机器名:" + Server.MachineName);
Response.Write("<br/>");
Response.Write("服务器IP地址:" + Request.ServerVariables["LOCAL_ADDR"]);
Response.Write("<br/>");
Response.Write("服务器域名:" + Request.ServerVariables["SERVER_NAME"]);
Response.Write("<br/>");
Response.Write(".NET解释引擎版本:" + ".NET CLR" + System.Environment.Version);
Response.Write("<br/>");
Response.Write("服务器操作系统版本:" + System.Environment.OSVersion.ToString());
Response.Write("<br/>");
Response.Write("服务器IIS版本:" + Request.ServerVariables["SERVER_SOFTWARE"]);
Response.Write("<br/>");
Response.Write("HTTP访问端口:" + Request.ServerVariables["SERVER_PORT"]);
Response.Write("<br/>");
Response.Write("虚拟目录的绝对路径:" + Request.ServerVariables["APPL_RHYSICAL_PATH"]);
Response.Write("<br/>");
Response.Write("执行文件的绝对路径:" + Request.ServerVariables["PATH_TRANSLATED"]);
Response.Write("<br/>");
Response.Write("Session总数:" + Session.Contents.Count.ToString());
Response.Write("<br/>");
Response.Write("Application总数:" + Application.Contents.Count.ToString());
Response.Write("<br/>");
Response.Write("缓存Cache总数:" + Cache.Count.ToString());
Response.Write("<br/>");
Response.Write("服务器主机:" + Request.ServerVariables["HTTP_HOST"]);
Response.Write("<br/>");
Response.Write("服务器区域语言:" + Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"]);
Response.Write("<br/>");
Response.Write("访客信息:" + Request.ServerVariables["HTTP_USER_AGENT"]);
Response.Write("<br/>");
Response.Write("服务器CPU个数:" + System.Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));
Response.Write("<br/>");
Response.Write("服务器CPU类型:" + System.Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER"));
Copy after login

You may ask that the values ​​of HTTP_HOST and SERVER_NAME are the same, what is the difference between them?
Usually the default server port is 80, HTTP_HOST will be omitted and the port number will not be displayed. If the server is not port 80, HTTP_HOST displays the port number.
Simply put: HTTP_HOST = SERVER_NAME:SERVER_PORT

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template