Environment versions
Network:
Windows 2003 Server
>>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);
I'm not sure how I would get that to work.
Site.Add doesn't exist in intellisense.
pvc.Add does, but it is looking for an object to be passed to it, so I'm not clear what I should pass to it.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only