FormsAuthenticationConfiguration.Protection プロパティ

定義

Cookie の暗号化に使用する暗号化の種類を取得または設定します。

public:
 property System::Web::Configuration::FormsProtectionEnum Protection { System::Web::Configuration::FormsProtectionEnum get(); void set(System::Web::Configuration::FormsProtectionEnum value); };
[System.Configuration.ConfigurationProperty("protection", DefaultValue=System.Web.Configuration.FormsProtectionEnum.All)]
public System.Web.Configuration.FormsProtectionEnum Protection { get; set; }
[<System.Configuration.ConfigurationProperty("protection", DefaultValue=System.Web.Configuration.FormsProtectionEnum.All)>]
member this.Protection : System.Web.Configuration.FormsProtectionEnum with get, set
Public Property Protection As FormsProtectionEnum

プロパティ値

FormsProtectionEnum列挙値の 1 つ。 既定値は All です。

メモ Cookie の保護に役立つデータ検証と暗号化の両方が必要な場合は、このプロパティの既定値を使用してください。 このオプションでは、 machineKeyに基づいて構成されたデータ検証アルゴリズムが使用されます。 Triple-DES (3DES) は、暗号化に使用されます (使用可能な場合、キーが十分な長さ (48 バイト以上) の場合)。

Cookie の保護を強化するために、 RequireSSLtrue に設定することもできます。

属性

次のコード例は、 Protection プロパティにアクセスする方法を示しています。 セクションを取得する方法については、 FormsAuthenticationConfiguration クラスのトピックのコード例を参照してください。

// Get the current Protection.
FormsProtectionEnum currentProtection =
    formsAuthentication.Protection;

// Set the Protection property.
formsAuthentication.Protection =
    FormsProtectionEnum.All;
' Get the current Protection.
Dim currentProtection As FormsProtectionEnum =
formsAuthentication.Protection

' Set the Protection property.
formsAuthentication.Protection = FormsProtectionEnum.All

適用対象

こちらもご覧ください