Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Request.ServerVariables["SERVER_SOFTWARE"];
- FileVersionInfo verinfo = FileVersionInfo.GetVersionInfo(System.Environment.SystemDirectory + @"inetsrvinetinfo.exe");
- //Tip... look at verinfo.MajorVersion.
- public Version GetIisVersion()
- {
- using (RegistryKey componentsKey =
- Registry.LocalMachine.OpenSubKey(@"SoftwareMicrosoftInetStp", false))
- {
- if (componentsKey != null)
- {
- int majorVersion = (int)componentsKey.GetValue("MajorVersion", -1);
- int minorVersion = (int)componentsKey.GetValue("MinorVersion", -1);
- if (majorVersion != -1 && minorVersion != -1)
- {
- return new Version(majorVersion, minorVersion);
- }
- }
- return new Version(0, 0);
- }
- }
Add Comment
Please, Sign In to add comment