Share via


StaticContentSection Class [IIS 7 and higher]

Exposes configuration settings for static content on a Web site.

Syntax

class StaticContentSection : ConfigurationSectionWithCollection

Methods

The following table lists the methods exposed by the StaticContentSection class.

Name

Description

Add

(Inherited from ConfigurationSectionWithCollection.)

Clear

(Inherited from ConfigurationSectionWithCollection.)

Get

(Inherited from ConfigurationSectionWithCollection.)

GetAllowDefinition

(Inherited from ConfigurationSection.)

GetAllowLocation

(Inherited from ConfigurationSection.)

Remove

(Inherited from ConfigurationSectionWithCollection.)

RevertToParent

(Inherited from ConfigurationSection.)

SetAllowDefinition

(Inherited from ConfigurationSection.)

SetAllowLocation

(Inherited from ConfigurationSection.)

Properties

The following table lists the properties exposed by the StaticContentSection class.

Name

Description

ClientCache

A read/write HttpClientCache value that exposes the client caching configuration.

DefaultDocFooter

A read/write string value that contains either the default footer text for every Web page on a site, or the path to a file that contains the default footer text. How this property is read depends on the setting of the IsDocFooterFileName property. The default is null.

EnableDocFooter

A read/write boolean value. true if the text indicated by DefaultDocFooter will appear on every static page on a Web site; otherwise, false. The default is false.

IsDocFooterFileName

A read/write boolean value. true if the string in DefaultDocFooter contains a path to a file that contains the default footer text for every static Web page on a site; otherwise, false. The default is false.

Location

(Inherited from ConfigurationSection.) A key property.

Path

(Inherited from ConfigurationSection.) A key property.

SectionInformation

(Inherited from ConfigurationSection.)

StaticContent

An array of read/write MimeMapElement objects that contain the MIME maps for static content.

Subclasses

This class contains no subclasses.

Remarks

The properties in this class correspond to the attributes and elements in the <staticContent> section of the ApplicationHost.config file.

Example

The following example shows the footer-text and client-cache properties of the StaticContentSection class.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

' Get the static content section.
Set oSection = oWebAdmin.Get("StaticContentSection.Path=" & _
    "'MACHINE/WEBROOT/APPHOST',Location=''")
' Show the path and location.
WScript.Echo "Path: " & oSection.Path
WScript.Echo "Location: " & oSection.Location
WScript.Echo

'Show the doc-footer-related properties.
WScript.Echo "Doc Footer properties"
WScript.Echo "---------------------"
WScript.Echo "EnableDocFooter: " & oSection.EnableDocFooter
WScript.Echo "IsDocFooterFileName: " & oSection.IsDocFooterFileName
WScript.Echo "DefaultDocFooter: " & oSection.DefaultDocFooter
WScript.Echo

' Show the embedded client-cache properties.
Set oClientCache = oSection.ClientCache
WScript.Echo "ClientCache properties"
WScript.Echo "----------------------"
WScript.Echo "CacheControlCustom: " & _
    oClientCache.CacheControlCustom
WScript.Echo "CacheControlMaxAge: " & _
    oClientCache.CacheControlMaxAge
WScript.Echo "CacheControlMode: " & _
    oClientCache.CacheControlMode
WScript.Echo "HttpExpires: " & _
    oClientCache.HttpExpires

Inheritance Hierarchy

ConfigurationSection

   ConfigurationSectionWithCollection

      StaticContentSection

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

ConfigurationSection Class [IIS 7 and higher]

ConfigurationSectionWithCollection Class [IIS 7 and higher]

HttpClientCache Class [IIS 7]

MimeMapElement Class [IIS 7 and higher]