HttpContext.Current != null

...this was breaking the ASP.NET Web Admin tool in .NET 4.0+, so I've changed it to a more appropriate check using HostingEnviornment.IsHosted