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";
}
}
}