RoleManagerSection.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 type of security that is used to protect the cookie that caches role names.
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
Property Value
The type of security protection used within the cookie where role names are cached. The default is All
.
- Attributes
Examples
The following code example demonstrates how to use the CookieProtection property. This code example is part of a larger example provided for the RoleManagerSection class.
// Display CookieProtection property.
Console.WriteLine("CookieProtection: {0}",
configSection.CookieProtection);
' Display CookieProtection property.
Console.WriteLine("CookieProtection: {0}", _
configSection.CookieProtection)
Remarks
The CookieProtection property describes how information in a cookie is securely stored. You can specify the security type of the cookie where roles are cached for your application by setting the cookieProtection
attribute in the Web.config file for your ASP.NET application. The cookieProtection
attribute takes a CookieProtection enumeration value of All
, Encryption
, None
, or Validation
. The default is All
. Be sure to use the default value for the CookieProtection property if you want both data validation and encryption to help protect the cookie. To improve the protection of your cookie, you can also set the CookieRequireSSL property to true
.