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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With