How to print similar information as phpinfo() but for ASP.NET? How to print similar information as phpinfo() but for ASP.NET? asp.net asp.net

How to print similar information as phpinfo() but for ASP.NET?


An empty page with this header should do the trick:

<%@ Page Trace="true"  Language="C#"     ContentType="text/html" ResponseEncoding="utf-8" %>


http://code.google.com/p/aspnetsysinfo/

The project is a ASP.Net System Information Prober. It's a single page which trying to get as much as possible of useful hosting information. The concept is similar to PHP page which contains phpinfo()...


ServerInfo.GetHtml() is basically the same as phpinfo(). Not only is the actual returned information extremely similar but also the html presentation. Here is a live demo!


You can also use it even if you're only making a pure Web API app, but letting a controller return a HttpResponseMessage like so:

    public System.Net.Http.HttpResponseMessage Get()    {        var serverinfo = System.Web.Helpers.ServerInfo.GetHtml().ToHtmlString();        var response = new System.Net.Http.HttpResponseMessage();        response.Content = new System.Net.Http.StringContent("<html><body>" + serverinfo + "</body></html>");        response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/html");        return response;    }