Bagikan melalui


RoleManagerSection.CookieProtection Properti

Definisi

Mendapatkan atau mengatur jenis keamanan yang digunakan untuk melindungi cookie yang menyimpan nama peran.

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

Nilai Properti

Jenis perlindungan keamanan yang digunakan dalam cookie tempat nama peran di-cache. Defaultnya adalah All.

Atribut

Contoh

Contoh kode berikut menunjukkan cara menggunakan CookieProtection properti . Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk RoleManagerSection kelas .

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

Keterangan

Properti menjelaskan CookieProtection bagaimana informasi dalam cookie disimpan dengan aman. Anda dapat menentukan jenis keamanan cookie tempat peran di-cache untuk aplikasi Anda dengan mengatur cookieProtection atribut dalam file Web.config untuk aplikasi ASP.NET Anda. Atribut cookieProtection mengambil CookieProtection nilai enumerasi dari All, , Encryption, Noneatau Validation. Defaultnya adalah All. Pastikan untuk menggunakan nilai default untuk CookieProtection properti jika Anda ingin validasi dan enkripsi data membantu melindungi cookie. Untuk meningkatkan perlindungan cookie Anda, Anda juga dapat mengatur CookieRequireSSL properti ke true.

Berlaku untuk

Lihat juga