Roles.CookieProtectionValue プロパティ

定義

Cookie にキャッシュされたロール名の保護方法を示す値を取得します。

public:
 static property System::Web::Security::CookieProtection CookieProtectionValue { System::Web::Security::CookieProtection get(); };
public static System.Web.Security.CookieProtection CookieProtectionValue { get; }
static member CookieProtectionValue : System.Web.Security.CookieProtection
Public Shared ReadOnly Property CookieProtectionValue As CookieProtection

プロパティ値

Cookie にキャッシュされているロール名を保護する方法を示す CookieProtection 列挙値の 1 つ。 既定値は All です。

次の例は、ASP.NET アプリケーションの Web.config ファイルの セクションの system.web 要素を示しています。 アプリケーションが SqlRoleProvider インスタンスを使用し、 cookieProtection 属性を Encryptedに設定することを指定します。

<roleManager defaultProvider="SqlProvider"
  enabled="true"
  cacheRolesInCookie="true"
  cookieName=".ASPROLES"
  cookieTimeout="30"
  cookiePath="/MyApplication"
  cookieRequireSSL="false"
  cookieSlidingExpiration="true"
  cookieProtection="Encrypted" >
  <providers>
    <add
      name="SqlProvider"
      type="System.Web.Security.SqlRoleProvider"
      connectionStringName="SqlServices"
      applicationName="MyApplication" />
  </providers>
</roleManager>

注釈

ASP.NET アプリケーションの Web.config ファイルで cookieProtection 属性を設定することで、アプリケーションのロールがキャッシュされる Cookie の保護を指定できます。 cookieProtection属性はCookieProtection列挙値を受け取ります。この列挙値は、ロール名が暗号化、検証、両方、またはどちらも行われないかを示します。

適用対象

こちらもご覧ください