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 6573771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:10:33+00:00 2026-05-25T15:10:33+00:00

I have written a Windows Application.My question is:I have been listing virtual directories in

  • 0

I have written a Windows Application.My question is:I have been listing virtual directories in IIS 6.0 with through code as below.I have to find pyhsical path of the virtual directory that are selected.
Also,DirectoryEntry class has a property called properties. But,I can’t use it. Lastly,I getting the following the error.

   The directory cannot report the number of properties

Code:

  try

  {

  string serverName = "localhost";

  string VirDirSchemaName = "IIsWebVirtualDir";

  iisServer = new DirectoryEntry("IIS://" + serverName + "/W3SVC/1");

  DirectoryEntry folderRoot = iisServer.Children.Find("Root",VirDirSchemaName);

  return folderRoot.Children;

  }

  catch (Exception e)

  {

  throw new Exception("Error while retrieving virtual directories.",e);

  }
  • 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. Editorial Team
    Editorial Team
    2026-05-25T15:10:34+00:00Added an answer on May 25, 2026 at 3:10 pm

    why don’t you use WMI

     using System.DirectoryServices;
    
        private DirectoryEntry _iisServer = null;
        private DirectoryEntry iisServer
        {
            get
            {
                if (_iisServer == null)
                {
                    string path = string.Format("IIS://{0}/W3SVC/1", serverName);
                    _iisServer = new DirectoryEntry(path);
                }
                return _iisServer;
            }
        }
    
        private IDictionary<string, DirectoryEntry> _virtualDirectories = null;
        private IDictionary<string, DirectoryEntry> virtualDirectories
        {
            get
            {
                if (_virtualDirectories == null)
                {
                    _virtualDirectories = new Dictionary<string, DirectoryEntry>();
    
                    DirectoryEntry folderRoot = iisServer.Children.Find("Root", VirDirSchemaName);
                    foreach (DirectoryEntry virtualDirectory in folderRoot.Children)
                    {
                        _virtualDirectories.Add(virtualDirectory.Name, virtualDirectory);
                    }
                }
                return _virtualDirectories;
            }
        }
    

    List all virtual directories in IIS 5,6 and 7

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

Sidebar

Related Questions

I have written a C# Windows Forms application, not a service (it is only
I have written a small .net Windows Forms application. And now I decided to
I have a windows application written in VB.net. After finishing it I'll setup the
I have written a basic Application for windows mobile 5. It is using visual
Assume i have a custom Windows application written in C#. This application has only
i have an windows mobile application written in c# compact framework which use barcode
I have C# Client application calling Windows webservice written in WCF calling Sql Procedure
We have a business application written for Windows mobile. It has people doing inventories.
We have a Windows desktop application written in Delphi that works fine on Windows
I'm creating a Windows Console application written in VB.NET and I have a few

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.