Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create A Virtual Directory Inside A Virtual Directory In IIS
Message
De
03/11/2008 06:48:26
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Create A Virtual Directory Inside A Virtual Directory In IIS
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01359105
Message ID:
01359105
Vues:
81
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)
{
if (Site.SchemaClassName == WebServerSchema)
{
//Response.Write("WebSite Instance ID : " + Site.Name);
foreach (string PropertyName in Site.Properties.PropertyNames)
{
//ListBox1.Items.Add(PropertyName);
//Response.Write(PropertyName);

PropertyValueCollection pvc = Site.Properties[PropertyName];

foreach (object ServerComment in pvc)
{
if (ServerComment.ToString().Trim() == webSiteName.Trim())
{
webSiteIdentifier = Site.Name;
}
}

}
}
}
}
catch (System.Exception ex)
{
errorMessage.Text = ex.Message;
errorMessage.ForeColor = System.Drawing.Color.Red;
webSiteIdentifier = "0";
}

return webSiteIdentifier;
}

However, I would like to create a Virtual Directory inside an existing named Virtual Directory - can anyone help?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform