I can create Virtual directories in an application with this code:
ServerManager iisManager = new ServerManager();
Application app = iisManager.Sites["NewSite"].Applications["/Sales"];
app.VirtualDirectories.Add("/VDir", "d:\\MyVDir");
iisManager.CommitChanges();
But I cannot create a Virtual directory in the root of the Website.
¿Any ideas?
The answer is this one:
ServerManager iisManager = new ServerManager();
Site mySite = iisManager.Sites["nameOfYourSite"];
mySite.Applications[0].VirtualDirectories.Add("/nameVirtualDirectory","VirtualDirectoryPath");
iisManager.CommitChanges();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.