Метод ConfigurationSectionWithCollection.Clear
Очищает все элементы из коллекции в разделе конфигурации.
Синтаксис
ConfigurationSectionWithCollection.Clear(collectionName);
ConfigurationSectionWithCollection.Clear(collectionName)
Параметры
Имя | Определение |
---|---|
collectionName |
Значение string типа , содержащее имя удаляемой коллекции. |
Возвращаемое значение
Этот метод не возвращает значение.
Пример
В следующем примере показано удаление документов по умолчанию, включая все унаследованные документы по умолчанию, для веб-сайта по умолчанию. Код приведет к добавлению следующего XML-кода в <system.webServer>
раздел файла Web.config для веб-сайта по умолчанию:
<defaultDocument>
<files>
<clear />
</files>
</defaultDocument>
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Get the default Web site.
Set oSite= oWebAdmin.Get("Site.Name='Default Web Site'")
' Get the default documents section.
oSite.GetSection "DefaultDocumentSection", oDefaultDocumentSection
' Clear the default documents that are listed in the
' DefaultDocumentSection.Files.Files property.
oDefaultDocumentSection.Clear("Files.Files")
Требования
Тип | Описание |
---|---|
клиент | — IIS 7.0 в Windows Vista — IIS 7.5 в Windows 7 — IIS 8.0 в Windows 8 — IIS 10.0 в Windows 10 |
Сервер | — IIS 7.0 в Windows Server 2008 — IIS 7.5 в Windows Server 2008 R2 — IIS 8.0 в Windows Server 2012 — IIS 8.5 в Windows Server 2012 R2 — IIS 10.0 в Windows Server 2016 |
Продукт | — IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
MOF-файл | WebAdministration.mof |
См. также:
Класс ConfigurationSectionWithCollection
Класс DefaultDocumentSection
Класс FileSettings