次の方法で共有


ConfigurationAttribute.SetMetadata(String, Object) メソッド

定義

IIS 7 構成システムの属性メタデータを設定します。

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)

パラメーター

metadataType
String

設定するメタデータの名前。

value
Object

メタデータに割り当てる値。

次の例では、各構成属性のメタデータを取得します。 このコード例は、ConfigurationAttribute クラスのために提供されている大規模な例の一部です。

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();

適用対象

こちらもご覧ください