Share via


Configuration.SetMetadata(String, Object) Method

Definition

Sets metadata in the IIS 7 configuration system.

public:
 void SetMetadata(System::String ^ metadataType, System::Object ^ value);
public void SetMetadata (string metadataType, object value);
member this.SetMetadata : string * obj -> unit
Public Sub SetMetadata (metadataType As String, value As Object)

Parameters

metadataType
String

The name of the metadata to set.

value
Object

The value to assign to the metadata.

Examples

The following example sets the metadata for the type specified by the metadataType parameter.

public void GetSetMetaData(ServerManager manager)
{
    //Configuration config = manager.GetAdministrationConfiguration();
    Configuration config = manager.GetApplicationHostConfiguration();
    config.SetMetadata("expandEnvironmentStrings", true);
}

Remarks

An error will occur if you call the SetMetadata method for a nonexistent metadataType.

The following table shows the metadata that you can set.

Metadata Description
availableSections Returns a comma-delimited series of strings that specify the names of all available administration sections that are defined in a schema. This includes any section in which schemas can be found in the inetsrv/config/schema directory, whether or not a section is registered in the <configSections> configuration section.
disableExtensions The default is false.
expandEnvironmentStrings The default is false. Determines whether to return environment variables in their default format (for example, %WINDIR%) or their expanded format (for example, D:\Windows\). This flag is set automatically when the read system is used and not set when the write system is used.
ignoreInvalidDecryption The default is true. Sets the flag to ignore invalid attributes when configuration sections are read. This enables the configuration system to not raise an error when it is reading a section that has an invalid attribute.
ignoreInvalidRanges The default is true. Sets the flag to ignore invalid attributes when configuration sections are read. This enables the configuration system to not raise an error when it is reading a section that has an invalid attribute range.
ignoreInvalidAttributes The default is false. Sets the flag to ignore invalid attributes when configuration sections are read. This enables the configuration system to not raise an error when it is reading a section that has an improperly decrypted attribute.
changeHandler The default is null. Enables monitoring of change notifications when any configuration change is applied to the system.
pathMapper Returns the IAppHostPathMapper interface that enables to the configuration system to override access to the configuration file that will be used at a given physical path, and optionally provides a new physical mapping location for the configuration file.
mappingExtension Returns the IAppHostMappingExtension interface that enables the configuration system to get virtual path mapping and site information.
hideExceptionPhysicalPath The default is false.

Applies to

See also