ConfigurationAttribute.SetMetadata(String, Object) Method

Definition

Sets attribute 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 gets the metadata for each of the configuration attributes. This code example is part of a larger example provided for the ConfigurationAttribute class.

ServerManager manager = new ServerManager();
Configuration config = manager.GetApplicationHostConfiguration();
ConfigurationSection configSection =
    config.GetSection("system.web/anonymousIdentification");

ConfigurationAttributeCollection configAttributeCollection =
    configSection.Attributes;

ConfigurationAttribute attribute = configAttributeCollection[1];
// Use any of the following encryption providers.
// attribute.SetMetadata("encryptionProvider", "IISWASOnlyRsaProvider");
// attribute.SetMetadata("encryptionProvider", "AesProvider");
attribute.SetMetadata("encryptionProvider", "IISWASOnlyAesProvider");

// Commit the changes to applicationHost.config
manager.CommitChanges();

Applies to

See also