Share via


ServerInfo Class

Displays information about the web server environment that hosts the current web page.

Inheritance Hierarchy

System.Object
  System.Web.Helpers.ServerInfo

Namespace:  System.Web.Helpers
Assembly:  System.Web.Helpers (in System.Web.Helpers.dll)

Syntax

'Declaration
Public NotInheritable Class ServerInfo
'Usage
public static class ServerInfo
public ref class ServerInfo abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type ServerInfo =  class end
public final class ServerInfo

The ServerInfo type exposes the following members.

Methods

  Name Description
Public methodStatic member GetHtml Displays information about the web server environment.

Top

Remarks

This class represents a helper, which is a component that simplifies web programming in ASP.NET Web Pages. You can use the ServerInfo class to troubleshoot issues with a website during development and testing. For example, the class can be used to display the virtual and physical paths of the pages in your application, which can help diagnose path-related issues in your code. The ServerInfo class includes many other types of information about the server environment that can be useful in solving programming or site issues, such as the identity of the logged-in user on the current web page, which version of Windows is running on the server, which HTTP method was used to request a web page (GET or POST), and so on.

To display information about the server, call the GetHtml method. The method displays information about the server in a series of HTML tables.

Security noteSecurity Note

Because the ServerInfo class displays important information about your server that includes its operating system, the physical path of website files, and security information, you should remove any references to the ServerInfo class before you publish a web page to a production server.

The ServerInfo class provides the following kinds of information about the web server:

Information Type

Examples

Server configuration

Local time on the server, machine name, operating system version, user name, current directory, processor count.

ASP.NET server variables

Physical path of the web application, path of the current web page, logon user identity, server protocol, HTTP request method, web server name, URL of the page.

HTTP runtime information

Path of key directories like Bin and the .NET Framework CLR directory, ASP.NET installation directory, cache size, and machine configuration directory.

Environment variables

Web site name, path of key system folders such as the Program Files and Windows installation directory, user domain name, operating system, value of the path variable on your computer.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Web.Helpers Namespace

Other Resources

IIS Server Variables

Recognized Environment Variables

Introduction to Debugging with ASP.NET Razor Pages