Share via


MachineKeySection.DecryptionKey プロパティ

定義

データの暗号化および復号化に使用されるキー、またはキーが生成されるプロセスを取得または設定します。

public:
 property System::String ^ DecryptionKey { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Configuration.WhiteSpaceTrimStringConverter))]
[System.Configuration.ConfigurationProperty("decryptionKey", DefaultValue="AutoGenerate,IsolateApps")]
[System.Configuration.StringValidator(MinLength=1)]
public string DecryptionKey { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Configuration.WhiteSpaceTrimStringConverter))>]
[<System.Configuration.ConfigurationProperty("decryptionKey", DefaultValue="AutoGenerate,IsolateApps")>]
[<System.Configuration.StringValidator(MinLength=1)>]
member this.DecryptionKey : string with get, set
Public Property DecryptionKey As String

プロパティ値

String

キー値、またはキーが生成される方法を示す値。 既定値は "AutoGenerate,IsolateApps" です。

属性

次の例では、コードを使用してプロパティを設定する DecryptionKey 方法を示します。 この例は、クラスに対して提供されるより大きな例の MachineKeySection 一部です。

// Display DecryptionKey property.
Console.WriteLine("DecryptionKey: {0}",
  configSection.DecryptionKey);
' Display DecryptionKey property.
Console.WriteLine("DecryptionKey: {0}", configSection.DecryptionKey)

注釈

このDecryptionKeyプロパティは、Windows フォーム認証などの暗号化と復号化、およびプロパティが "3DES" または "AES" に設定されている場合Validationのビューステートに使用されます。

"AutoGenerate" オプションを使用して、ASP.NET がランダム キーを生成し、ローカル セキュリティ機関に格納することを指定します。 "AutoGenerate" オプションは既定値の一部です。

"AutoGenerateValidationKey" 値に "IsolateApps" 修飾子を追加すると、ASP.NET は、各アプリケーションを使用してアプリケーションごとに一意のAppDomainAppVirtualPath暗号化キーを生成します。 これが既定の設定です。

"AutoGenerateValidationKey" 値に "IsolateByAppId" 修飾子を追加すると、ASP.NET は、各アプリケーションを使用してアプリケーションごとに一意のAppDomainAppId暗号化キーを生成します。 2 つの異なるアプリケーションが仮想パスを共有する場合 (これらのアプリケーションが異なるポートで実行されている可能性があるため)、このフラグを使用して、それらを相互に区別できます。 "IsolateByAppId" フラグは、ASP.NET 4.5 でのみ認識されますが、設定にMachineKeySection.CompatibilityMode関係なく使用できます。

Web サーバー (Web ファーム) のネットワーク経由での構成をサポートする必要がある場合は、一貫性のある構成を確保するためにプロパティを DecryptionKey 手動で設定します。 属性の値DecryptionKeyを手動で生成する方法については、「方法: ASP.NET 2.0 で MachineKey を構成する」を参照してください。

このプロパティは、通常、Web.config ファイルの machineKey 要素の属性で宣言によってDecryptionKey設定されます。 詳細については、 machineKey 要素を参照してください。

適用対象

こちらもご覧ください