Web Server Information using .NET

This article is about a tool which you can use to get information like encoding, cookie details, web server name, server language, their version numbers, etc.

We cannot guarantee as it is possible for the server guys to fake/disable parameters if they wish.

WebClient belongs to System.Net.WebClient. You can find the MSDN page here – http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx

WebClient provides common methods for sending data to and receiving data from a resoruce identified by a URI.

This feature is available from .NET Framework version 2.0. I have made use of this feature for building this handy tool.

This is the heart code of this tool which gets data from the server and displays the parameters to a textbox.

WebClient wc = new WebClient();wc.Headers.Add(“user-agent”, “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)”);wc.OpenRead(site);for (int i = 0; i < wc.ResponseHeaders.Count; i++){ sb.Append((i + 1).ToString() + “. [” + wc.ResponseHeaders.AllKeys[i] + “] => ” + wc.ResponseHeaders[i] + Environment.NewLine + Environment.NewLine);}textBox1.Text = sb.ToString();

WebClient.ResponseHeaders is the property which brings our necessary parameters from the server.

Well, technology enthusiasts, I would say. If somebody is interested to know which website runs on which server/language, then this tool is for them.

Some of my observations with this tool here:

google.com – gws (Google Web Server)codeproject.com – IIS6, ASP.NET 4.0microsoft.com – IIS 7.5/ASP.NET 4.0msdn – IIS 7.5/ASP.NET 2.0php.net – Apache 1.3/PHP 5.2apache.org – Apache 2.3python.org – Apache 2.3/Python 2.5gmail – GSE (Google Search Extension)oracle.com – Oracle Application Serverjava.com – Sun Java System Web Server

View the original article here

Leave a Comment