Last post Sep 07, 2012 05:37 AM by Aspper ASP
Aug 30, 2012 11:32 AM|DJ Lance Rock|LINK
I'm trying to read the .NET framework for a web application/virtual directory. I did some poking around in the metabase using System.DirectoryServices.DirectoryEntry. I came up with the following:
static string GetDotNetVersion(string webApp)
string propName = "ScriptMaps";
DirectoryEntry myEntry = new DirectoryEntry(webApp);
PropertyCollection props = myEntry.Properties;
string dotNetVersion = "";
foreach (object value in myEntry.Properties[propName])
dotNetVersion = value.ToString().Substring(value.ToString().IndexOf(@"Microsoft.NET\Framework") + @"Microsoft.NET\Framework".Length + 2).Substring(0, 3);
It worked okay, it returned 4.0, but then I went into IIS Admin and changed the framework on an AppPool that was associated with my Web Application from 4.0 to 2.0. However, my function is stil returning 4.0. Any idea why? Is there a better way to do
My webApp looks like: "IIS://Localhost/W3SVC/1/Root/MyWebApp".
Sep 07, 2012 05:37 AM|Aspper ASP|LINK
Did you try to restart your IIS? Sometimes it works.