Get IIS version : Registry « Development Class « C# / C Sharp






Get IIS version

        

using System.Linq;
using System.Web;
using Microsoft.Win32;

public static class Helper
{
    public static string GetIISVersion()
    {
        using (var componentsKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\InetStp", false))
        {
            if (componentsKey != null)
            {
                var majorVersion = (int)componentsKey.GetValue("MajorVersion", -1);
                var minorVersion = (int)componentsKey.GetValue("MinorVersion", -1);
                if (majorVersion != -1 && minorVersion != -1)
                {
                    return majorVersion + "." + minorVersion;
                }
            }
            return "Unknown";
        }
    }
}

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Registry.LocalMachine
2.Write a Text and DWord Value to the Registry
3.Enumerating Registry Keys
4.Retrieve the CPU Type and Speed from the Registry
5.Use GetValue and SetValue to get and save value to Registry
6.Get the Registry key found for CurrentUser
7. Accessing the Registry
8.Open a SubKey in Registry
9.Get Registry value Get Registry value
10.Registry File Association
11.Check Registry to see if it is installed
12.Get/Set User Registry
13.Copy Registry
14.Registry Utils
15.Retrieves any Registry value that uses the REGBINARY data type.
16.Writes a Registry value to the Registry.