Share via


FormsAuthenticationConfiguration.Protection プロパティ

定義

クッキーの暗号化に使用される暗号化タイプを取得または設定します。

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 列挙値のいずれか。 既定値は All です。

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

クッキーのセキュリティを強化するために、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

適用対象

こちらもご覧ください