Share via


Configuration.GetMetadata(String) Method

Definition

Gets metadata from the IIS 7 configuration system.

public:
 System::Object ^ GetMetadata(System::String ^ metadataType);
public object GetMetadata (string metadataType);
member this.GetMetadata : string -> obj
Public Function GetMetadata (metadataType As String) As Object

Parameters

metadataType
String

The name of the metadata to return.

Returns

The metadata that matches the requested metadataType from the IIS 7 configuration system.

Examples

The following example gets the metadata for the specified metadataType type. In this example, the specified type is set in the SetMetadata method. To get any other type, remove the comment delimiter from the appropriate line.

public void GetGetMetaData(ServerManager manager)
{
    // Use either of the configuration statements.
    //Configuration config = manager.GetAdministrationConfiguration();
    Configuration config = manager.GetApplicationHostConfiguration();
    // Any of the following GetMetadata statements are satisfactory.
    //Configuration config = manager.GetApplicationHostConfiguration();
    //Console.WriteLine("Metadata: " + config.GetMetadata("availableSections"));
    //Console.WriteLine("Metadata: " + config.GetMetadata("disableExtensions"));
    Console.WriteLine("Metadata: " + config.GetMetadata("expandEnvironmentStrings"));
    //Console.WriteLine("Metadata: " + config.GetMetadata("ignoreInvalidDecryption"));
    //Console.WriteLine("Metadata: " + config.GetMetadata("ignoreInvalidRanges"));
    //Console.WriteLine("Metadata: " + config.GetMetadata("ignoreInvalidAttributes"));
    //Console.WriteLine("Metadata: " + config.GetMetadata("changeHandler"));
    //Console.WriteLine("Metadata: " + config.GetMetadata("pathMapper"));
    //Console.WriteLine("Metadata: " + config.GetMetadata("mappingExtension"));
    //Console.WriteLine("Metadata: " + config.GetMetadata("hideExceptionPhysicalPath"));
}

Remarks

This method returns the value of the specified metadata property, the type of which depends on the returned property.

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

Applies to

See also