Show server information with ASP.NET Web Pages

Post in swedish:

[Coming]

Those who are using PHP might have big use of phpinfo() which sows information about the server and the current runtime. This function have not been around in ASP.NET, and the only thing we have had is the Trace which can show information about what have been loaded on the page.

In ASP.NET Web Pages there is a new helper function called ServerInfo. What it does is to print the information in a table with four categories:

  • Server Configuration
    • Information about the server´s hardware and software.
  • ASP.NET Server Variables
    • Variable with IP, port, URL, path etc.
  • HTTP Runtime Information
    • Information about .NET. Shows the current version, where .NET is installed, which AppDomain is used and other information.
  • Environment Variables
    • Displays information about the environment such as information about the user.

This information kan be good to have on a admin site where you want to get information about the server and hardware, which can be good to know if something unexpected occurs on the site.

To display this information on a page, all you have to do is to add this code:

@ServerInfo.GetHtml()

What you will se in the browser is:

clip_image002

The post is available as pdf and xps here:

http://cid-4aa13e17331c7398.office.live.com/browse.aspx/Public/Artiklar/ASP.NET%20Web%20Pages?uc=4

4 Comments

Comments have been disabled for this content.