I\'ve looped over the Request.ServerVariables
collection in ASP.NET, but it\'s not as comprehensive as phpinfo()
.
How can I print all that
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("" + serverinfo + "");
response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/html");
return response;
}