Here is a C # code snippet that should do the trick:
using System.DirectoryServices
static void Main(string[] args)
{
using (DirectoryEntry de = new DirectoryEntry("IIS://localhost/W3SVC"))
{
foreach (string ext in de.Properties["WebSvcExtRestrictionList"])
{
if (ext.StartsWith("1,") && ext.IndexOf("ASP.NET v1.1") != -1)
{
Console.WriteLine("ASP.NET 1.1 is enabled");
}
if (ext.StartsWith("1,") && ext.IndexOf("ASP.NET v2.0") != -1)
{
Console.WriteLine("ASP.NET 2.0 is enabled");
}
}
}
}
You need to add the assembly reference in System.DirectoryServicesthe .NET tab of the Add Links dialog box.
source
share