Roles.CookieProtectionValue Property
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 a value that indicates how role names cached in a cookie are protected.
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
One of the CookieProtection enumeration values indicating how role names that are cached in a cookie are protected. The default is All
.
The following example shows the roleManager element in the system.web
section of the Web.config file for an ASP.NET application. It specifies that the application uses a SqlRoleProvider instance and sets cookieProtection
attribute to 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>
You can specify the protection 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 that indicates whether the role names are encrypted, validated, both, or neither.
Product | Versions |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: