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);
}