Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 152765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:40:55+00:00 2026-05-11T09:40:55+00:00

How do I find out the .NET framework of an IIS virtual directory is

  • 0

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 = string.Concat(path, '/', directory);             }              break;          case IISVersion.IIS6:             path = string.Format('IIS://{0}/W3SVC', server);              if(!string.IsNullOrEmpty(directory))             {                 DirectoryEntry de = new DirectoryEntry(path);                  foreach(DirectoryEntry child in de.Children)                 {                     if(child.Properties['ServerComment'].Value.ToString().ToLower() == directory)                     {                         siteID = child.Name;                         break;                     }                 }                  path = string.Concat(path, '/', siteID);                  de.Close()                 de = null;             }              break;     }      DirectoryEntry iis = new DirectoryEntry(path);      //display iis properties here...     //need to display if the virtual directory is running under .NET 1.1 or 2.0      iis.Close();     iis = null;        } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:40:55+00:00Added an answer on May 11, 2026 at 9:40 am

    In IIS there’s no hard and fast way to find out which ASP.NET version is used by a website or ‘virtual’ directory (website application folder – the one that has cogs as an icon).

    The reason for this is that IIS and the metabase data only know about scriptmaps and not ASP.NET versions (after all ASP.NET is just another ISAPI application). One way to determine the version of ASP.NET is to use something like the following:

    using System; using System.DirectoryServices; namespace ConsoleApplication1 {     class Program     {         static void Main(string[] args)         {             string path = @'IIS://Localhost/W3SVC/1/root/MyApp';             Console.WriteLine(GetAspNetVersion(path));         }          private static string GetAspNetVersion(string path)         {             using (DirectoryEntry app = new DirectoryEntry(path))             {                 PropertyValueCollection pvc = app.Properties['ScriptMaps'];                  foreach (string scriptMap in pvc)                 {                     if (scriptMap.StartsWith('.aspx'))                     {                         string[] mapping = scriptMap.Split(',');                         string scriptProcessor = mapping[1];                          // The version numbers come from the path                         // C:\Windows\Microsoft.NET\Framework\                         // which will be present in the script processor                          // DLL path                         if (scriptProcessor.Contains('v1.1.4322'))                         {                             return '1.1';                         }                          if (scriptProcessor.Contains('v2.0.50727'))                         {                             return '2.0';                         }                     }                 }                 throw new Exception('Unknown version ASP.NET version.');             }         }     } } 

    It’s not ideal but hasn’t failed our needs as a hoster for our provisioning applications/services. I suspect the IIS MMC plug-in performs a similar check behind the scenes. My own detailed examination of the metabase (Windows 2000 and Windows 2003 file based XML) reveals that there isn’t a conspicuous property/attribute that stores a specific ASP.NET version number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer $('#generate').toggle(function() { $('#outer').removeClass('New2').addClass('New1'); }, function() { $('#outer').removeClass('New1').addClass('New2'); }); or $('#generate').click(function()… May 11, 2026 at 12:33 pm
  • added an answer I do not have a schema to drop at hand,… May 11, 2026 at 12:33 pm
  • added an answer There is nothing wrong with your installation or environment. The… May 11, 2026 at 12:33 pm

Related Questions

How do I find out which sound files the user has configured in the
Possible Duplicate: How do I find out which DOM element has the focus? Is
Under Linux, how do I find out which process is using the swap space
How do I programatically (Using C#) find out what the path is of my
How do I find out which process is listening on a TCP or UDP
I've written an application that handles most exceptions gracefully, with the page's design intact
I have an Asp.NET application (VS2008, Framework 2.0). When I try to set a
I am a little ashamed to say that I have never used an ORM;
I recently wrote a DLL in C# (.Net 2.0) which contains a class that
One thing I've always wondered about is how software patches work. A lot of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.