C# coding tip: showing IIS and ASP.NET information quickly
Posted: (EET/GMT+2)
If you are working with ASP.NET web applications and the IIS web server, there is often the need to quickly know information about the current application pool, Windows account (the identity), .NET framework version, and so forth. To help me quickly get this information, I often create a really simple web application with Visual Studio that contains a single ASPX page. Then I put a label onto the page, and type in code similar to the following to the Page_Load event handler.
Here is an example when using ASP.NET Web Forms:
SystemInfoLabel.Text = "Application pool .NET version: " + Environment.Version + "
\r\n" + "64-bit process: " + Environment.Is64BitProcess + "
\r\n" + "Pool identity: " + System.Security.Principal. WindowsIdentity.GetCurrent().Name + "
\r\n"+ "Culture/UI culture: " + Thread.CurrentThread.CurrentCulture.Name + "/" + Thread.CurrentThread.CurrentUICulture.Name;
With this code in place, you can quickly get the information you need, without asking the customer/administrator, or wandering around in the management utilities.