Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create A Virtual Directory Inside A Virtual Directory In
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01359105
Message ID:
01359152
Views:
25
>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);
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform