Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 information, including server software, drivers, etc, for ASP.NET?

like image 983
frankadelic Avatar asked Feb 13 '09 00:02

frankadelic


3 Answers

An empty page with this header should do the trick:

<%@ Page Trace="true"  Language="C#" 
    ContentType="text/html" ResponseEncoding="utf-8" %>
like image 126
Malik Avatar answered Oct 02 '22 15:10

Malik


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()...

like image 21
Rick Avatar answered Oct 02 '22 16:10

Rick


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;
    }
like image 9
aidinabedi Avatar answered Oct 02 '22 16:10

aidinabedi