Поделиться через


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

Применяется к

См. также раздел