Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

ConfigurationSectionWithCollection.Clear Method [IIS 7 and higher]

IIS 7.0

Clears all elements from a collection in a configuration section.

ConfigurationSectionWithCollection.Clear(collectionName);
ConfigurationSectionWithCollection.Clear(collectionName)

Name

Definition

collectionName

A string value that contains the name of the collection to be removed.

This method does not return a value.

The following example clears the default documents, including all inherited default documents, for the default Web site. The code will cause the following XML to be added to the <system.webServer> section of the Web.config file for the default Web site:

<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")

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

Community Additions

ADD
Show:
© 2015 Microsoft