Today I just learned from Rick strahl Blog we can get IIS Version using Server variable like
if (HttpContext.Current != null && HttpContext.Current.Request != null) { string osversion = HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"]; if (!string.IsNullOrEmpty(osversion)) { //Microsoft-IIS/7.5 int dashlenth = osversion.LastIndexOf("/"); if (dashlenth > 0) { decimal iisVersion = 0M; if (Decimal.TryParse(osversion.Substring(dashlenth + 1), out iisVersion)) return iisVersion; } } }
Thank You
Published under: Microsoft .NET Tips · · · ·