Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Clears all elements from a collection in a configuration section.
Syntax
ConfigurationSectionWithCollection.Clear(collectionName);
ConfigurationSectionWithCollection.Clear(collectionName)
Parameters
| Name | Definition | 
|---|---|
| collectionName | A string value that contains the name of the collection to be removed. | 
Return Value
This method does not return a value.
Example
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")
Requirements
| Type | Description | 
|---|---|
| Client | Requires IIS 7 on Windows Vista. | 
| Server | Requires IIS 7 on Windows Server 2008. | 
| Product | IIS 7 | 
| MOF file | WebAdministration.mof | 
See Also
Reference
ConfigurationSectionWithCollection Class [IIS 7 and higher]