AnonymousIdentificationSection.CookieProtection Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the encryption type used to encrypt the cookie.
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.Validation)]
public System.Web.Security.CookieProtection CookieProtection { get; set; }
[<System.Configuration.ConfigurationProperty("cookieProtection", DefaultValue=System.Web.Security.CookieProtection.Validation)>]
member this.CookieProtection : System.Web.Security.CookieProtection with get, set
Public Property CookieProtection As CookieProtection
Property Value
One of the CookieProtection values. The default value is All.
- Attributes
Examples
The following code example shows how to access the CookieProtection property.
// Get CookieProtection.
System.Web.Security.CookieProtection cookieProtection =
anonymousIdentificationSection.CookieProtection;
Console.WriteLine("Cookie protection: {0}",
cookieProtection);
' Get CookieProtection.
Dim cookieProtection _
As System.Web.Security.CookieProtection = _
anonymousIdentificationSection.CookieProtection
Console.WriteLine( _
"Cookie protection: {0}", cookieProtection)
Remarks
To improve the protection of your cookie, you may want also set the CookieRequireSSL property to true
.
Be sure to use the default value for this property if you want both data validation and encryption to help protect the cookie. This option uses the configured data-validation algorithm. Triple-DES (3DES) is used for encryption, if available and if the key is long enough (48 bytes or more).
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應