How do I determine the ASP.NET version of a virtual directory or website using C#?
问题 How do I find out the .NET framework of an IIS virtual directory is using in C#. I need to display it to the user. using System.DirectoryServices; using System.IO; private enum IISVersion { IIS5, IIS6 } private void ReadVirtualDirectory(string server, string directory, IISVersion version) { string siteID = string.Empty; string path = string.Empty; switch(verison) { case IISVersion.IIS5: path = string.Format("IIS://{0}/W3SVC/1/Root", server); if(!string.IsNullOrEmpty(directory)) { path =