>I can use the following to create a Virtual Directory under a folder in IIS:
>
>IISAdmin = new System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/" + webSiteNum + "/Root");
>VDir = IISAdmin.Children.Add(VDirName, "IIsWebVirtualDir");
>
>webSiteNum is obtained with the following function:
>
> public static string getWebSiteIdentifier(string webSiteName, Label errorMessage)
> {
> string webSiteIdentifier = "0";
>
> try
> {
> const string WebServerSchema = "IIsWebServer";
> string ServerName = "LocalHost";
> DirectoryEntry W3SVC = new DirectoryEntry("IIS://" + ServerName + "/w3svc");
>
> foreach (DirectoryEntry Site in W3SVC.Children)
> {
> }
>
>However, I would like to create a Virtual Directory inside an existing named Virtual Directory - can anyone help?
I haven't tried this, but it would seem like you should be able to use the reference you get inside of the loop for W3SVC.Children to create another Virtual Directory, eg. Site.Add(path here);