Use the .NET directory service to access the IIS settings, adding a virtual directory is actually a DirectoryEntry complex in the DirectoryEntry's properties, in fact, the virtual purpose configuration, such as rights, whether to log, application name, etc. And the document is not very easy to find details can be referred to MSDN The following content help: //ms.msdnqtr.2004jul.1033/Iissdk/iis/configing_properties_in_the_iis_user_interface.htm
Code example:
Const string constiisWebsiteroot = "IIS: // localhost / w3svc / 1 / root";
DirectoryEntry Root = New DirectoryEntry; DirectoryEntry Entry = New DirectoryEntry (ConstiisWebsiteroot / " VirtualDirName);
DirectoryEntry TBENTRY = root.children.add (VirtualDirName, "IisWebVirtualdir");
//rust be end with a '/' tbentry.properties ["path"] [0] = VirtualDirPath; TBENTRY.INVOKE ("AppCreate", True); TBENTRY.PROPERTIES ["AccessRead"] [0] = true; TBENTRY .Properties ["contentIndexed"] [0] = false; tbentry.properties ["defaultdoc"] [0] = "index.asp"; tbentry.properties ["AppFriendlyName"] [0] = VirtualDirName; TBENTRY.PROPERTIES [" Appisolated "] [0] = 2; TBENTRY.PROPERTIES [" AccessScript "] [0] = true; tbentry.properties [" DONTLOG "] [0] = true; tbitry.commitchanges ();
Published in Friday, November 05, 2004 4:46 PM href = "http://blog.joycode.com/yaodong/services/pingback.aspx" Rel = "pingback" />